@@ -191,16 +191,16 @@ function walk_to_defs(compact::IncrementalCompact, @nospecialize(defssa), @nospe
191
191
def = compact[defssa]
192
192
if isa (def, PhiNode)
193
193
push! (visited_phinodes, defssa)
194
- possible_predecessors = let def = def, typeconstraint = typeconstraint
195
- collect (Iterators . filter ( 1 : length (def. edges)) do n
196
- isassigned (def. values, n) || return false
197
- val = def. values[n]
198
- if is_old (compact, defssa) && isa (val, SSAValue)
199
- val = OldSSAValue (val. id)
200
- end
201
- edge_typ = widenconst (compact_exprtype (compact, val))
202
- return typeintersect (edge_typ, typeconstraint) != = Union{}
203
- end )
194
+ possible_predecessors = Int[]
195
+ for n in 1 : length (def. edges)
196
+ isassigned (def. values, n) || continue
197
+ val = def. values[n]
198
+ if is_old (compact, defssa) && isa (val, SSAValue)
199
+ val = OldSSAValue (val. id)
200
+ end
201
+ edge_typ = widenconst (compact_exprtype (compact, val))
202
+ typeintersect (edge_typ, typeconstraint) === Union{} && continue
203
+ push! (possible_predecessors, n )
204
204
end
205
205
for n in possible_predecessors
206
206
pred = def. edges[n]
@@ -829,15 +829,16 @@ function adce_erase!(phi_uses, extra_worklist, compact, idx)
829
829
end
830
830
end
831
831
832
- function count_uses (stmt, uses)
832
+ function count_uses (@nospecialize ( stmt) , uses:: Vector{Int} )
833
833
for ur in userefs (stmt)
834
- if isa (ur[], SSAValue)
835
- uses[ur[]. id] += 1
834
+ use = ur[]
835
+ if isa (use, SSAValue)
836
+ uses[use. id] += 1
836
837
end
837
838
end
838
839
end
839
840
840
- function mark_phi_cycles (compact, safe_phis, phi)
841
+ function mark_phi_cycles (compact:: IncrementalCompact , safe_phis:: BitSet , phi:: Int )
841
842
worklist = Int[]
842
843
push! (worklist, phi)
843
844
while ! isempty (worklist)
@@ -864,7 +865,7 @@ function adce_pass!(ir::IRCode)
864
865
end
865
866
non_dce_finish! (compact)
866
867
for phi in all_phis
867
- count_uses (compact. result[phi], phi_uses)
868
+ count_uses (compact. result[phi]:: PhiNode , phi_uses)
868
869
end
869
870
# Perform simple DCE for unused values
870
871
extra_worklist = Int[]
@@ -880,7 +881,7 @@ function adce_pass!(ir::IRCode)
880
881
changed = true
881
882
while changed
882
883
changed = false
883
- safe_phis = IdSet {Int} ()
884
+ safe_phis = BitSet ()
884
885
for phi in all_phis
885
886
# Save any phi cycles that have non-phi uses
886
887
if compact. used_ssas[phi] - phi_uses[phi] != 0
@@ -898,7 +899,7 @@ function adce_pass!(ir::IRCode)
898
899
end
899
900
end
900
901
end
901
- complete (compact)
902
+ return complete (compact)
902
903
end
903
904
904
905
function type_lift_pass! (ir:: IRCode )
0 commit comments