Skip to content

Commit 62e4d49

Browse files
committed
Defensively fix patterns similar to #29983
I don't have concrete tests for these, but it looks like they all need the `is_old` predicate for what they're doing, so switch those over also while we're at it.
1 parent 83b3550 commit 62e4d49

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

base/compiler/ssair/passes.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ function simple_walk(compact::IncrementalCompact, @nospecialize(defssa#=::AnySSA
130130
return defssa
131131
end
132132
if isa(def.val, SSAValue)
133-
if isa(defssa, OldSSAValue) && !already_inserted(compact, defssa)
133+
if is_old(compact, defssa)
134134
defssa = OldSSAValue(def.val.id)
135135
else
136136
defssa = def.val
@@ -281,7 +281,7 @@ function lift_leaves(compact::IncrementalCompact, @nospecialize(stmt),
281281
end
282282
if is_tuple_call(compact, def) && isa(field, Int) && 1 <= field < length(def.args)
283283
lifted = def.args[1+field]
284-
if isa(leaf, OldSSAValue) && isa(lifted, SSAValue)
284+
if is_old(compact, leaf) && isa(lifted, SSAValue)
285285
lifted = OldSSAValue(lifted.id)
286286
end
287287
if isa(lifted, GlobalRef) || isa(lifted, Expr)
@@ -320,7 +320,7 @@ function lift_leaves(compact::IncrementalCompact, @nospecialize(stmt),
320320
compact[leaf] = def
321321
end
322322
lifted = def.args[1+field]
323-
if isa(leaf, OldSSAValue) && isa(lifted, SSAValue)
323+
if is_old(compact, leaf) && isa(lifted, SSAValue)
324324
lifted = OldSSAValue(lifted.id)
325325
end
326326
if isa(lifted, GlobalRef) || isa(lifted, Expr)
@@ -339,7 +339,7 @@ function lift_leaves(compact::IncrementalCompact, @nospecialize(stmt),
339339
# N.B.: This can be a bit dangerous because it can lead to
340340
# infinite loops if we accidentally insert a node just ahead
341341
# of where we are
342-
if isa(leaf, OldSSAValue) && (isa(field, Int) || isa(field, Symbol))
342+
if is_old(compact, leaf) && (isa(field, Int) || isa(field, Symbol))
343343
(isa(typ, DataType) && (!typ.abstract)) || return nothing
344344
@assert !typ.mutable
345345
# If there's the potential for an undefref error on access, we cannot insert a getfield

0 commit comments

Comments
 (0)