Skip to content

Commit 4ffd735

Browse files
nsajkoKristofferC
authored andcommitted
Compiler: walk_to_defs, collect_leaves: specialize for predecessors (#57859)
Should make the code less vulnerable to invalidation. (cherry picked from commit d9441ac)
1 parent 383a8b8 commit 4ffd735

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Compiler/src/ssair/passes.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ function find_def_for_use(
183183
end
184184

185185
function collect_leaves(compact::IncrementalCompact, @nospecialize(val), @nospecialize(typeconstraint), 𝕃ₒ::AbstractLattice,
186-
predecessors = ((@nospecialize(def), compact::IncrementalCompact) -> isa(def, PhiNode) ? def.values : nothing))
186+
predecessors::Pre = ((@nospecialize(def), compact::IncrementalCompact) -> isa(def, PhiNode) ? def.values : nothing)) where {Pre}
187187
if isa(val, Union{OldSSAValue, SSAValue})
188188
val, typeconstraint = simple_walk_constraint(compact, val, typeconstraint)
189189
end
@@ -271,7 +271,7 @@ Starting at `val` walk use-def chains to get all the leaves feeding into this `v
271271
`predecessors(def, compact)` is a callback which should return the set of possible
272272
predecessors for a "phi-like" node (PhiNode or Core.ifelse) or `nothing` otherwise.
273273
"""
274-
function walk_to_defs(compact::IncrementalCompact, @nospecialize(defssa), @nospecialize(typeconstraint), predecessors, 𝕃ₒ::AbstractLattice)
274+
function walk_to_defs(compact::IncrementalCompact, @nospecialize(defssa), @nospecialize(typeconstraint), predecessors::Pre, 𝕃ₒ::AbstractLattice) where {Pre}
275275
visited_philikes = AnySSAValue[]
276276
isa(defssa, AnySSAValue) || return Any[defssa], visited_philikes
277277
def = compact[defssa][:stmt]

0 commit comments

Comments
 (0)