@@ -247,7 +247,7 @@ mutable struct InferenceState
247
247
# TODO : Could keep this sparsely by doing structural liveness analysis ahead of time.
248
248
bb_vartables:: Vector{Union{Nothing,VarTable}} # nothing if not analyzed yet
249
249
ssavaluetypes:: Vector{Any}
250
- stmt_edges:: Vector{Union{Nothing, Vector{Any} }}
250
+ stmt_edges:: Vector{Vector{Any}}
251
251
stmt_info:: Vector{CallInfo}
252
252
253
253
#= intermediate states for interprocedural abstract interpretation =#
@@ -298,7 +298,7 @@ mutable struct InferenceState
298
298
nssavalues = src. ssavaluetypes:: Int
299
299
ssavalue_uses = find_ssavalue_uses (code, nssavalues)
300
300
nstmts = length (code)
301
- stmt_edges = Union{Nothing, Vector{Any}}[ nothing for i = 1 : nstmts ]
301
+ stmt_edges = Vector { Vector{Any}}(undef, nstmts)
302
302
stmt_info = CallInfo[ NoCallInfo () for i = 1 : nstmts ]
303
303
304
304
nslots = length (src. slotflags)
@@ -805,26 +805,27 @@ function record_ssa_assign!(𝕃ᵢ::AbstractLattice, ssa_id::Int, @nospecialize
805
805
return nothing
806
806
end
807
807
808
- function add_cycle_backedge! (caller:: InferenceState , frame:: InferenceState , currpc :: Int )
808
+ function add_cycle_backedge! (caller:: InferenceState , frame:: InferenceState )
809
809
update_valid_age! (caller, frame. valid_worlds)
810
- backedge = (caller, currpc)
810
+ backedge = (caller, caller . currpc)
811
811
contains_is (frame. cycle_backedges, backedge) || push! (frame. cycle_backedges, backedge)
812
812
add_backedge! (caller, frame. linfo)
813
813
return frame
814
814
end
815
815
816
816
function get_stmt_edges! (caller:: InferenceState , currpc:: Int = caller. currpc)
817
817
stmt_edges = caller. stmt_edges
818
- edges = stmt_edges[currpc]
819
- if edges === nothing
820
- edges = stmt_edges[currpc] = []
818
+ if ! isassigned (stmt_edges, currpc)
819
+ return stmt_edges[currpc] = Any[]
820
+ else
821
+ return stmt_edges[currpc]
821
822
end
822
- return edges
823
823
end
824
824
825
825
function empty_backedges! (frame:: InferenceState , currpc:: Int = frame. currpc)
826
- edges = frame. stmt_edges[currpc]
827
- edges === nothing || empty! (edges)
826
+ if isassigned (frame. stmt_edges, currpc)
827
+ empty! (frame. stmt_edges[currpc])
828
+ end
828
829
return nothing
829
830
end
830
831
0 commit comments