Skip to content

Commit 270ea64

Browse files
authored
sroa: Relax scope assertion (#52866)
It's possible for this assertion to be violated if there's dead code in the middle of the function. I think the best thing to do here is just to relax the assertion to allow this particular case. Fixes #52819.
1 parent 314d40f commit 270ea64

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

base/compiler/ssair/passes.jl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,18 @@ function (this::IntermediaryCollector)(@nospecialize(pi), @nospecialize(ssa))
11471147
end
11481148

11491149
function update_scope_mapping!(scope_mapping, bb, val)
1150-
@assert (scope_mapping[bb] in (val, SSAValue(0)))
1150+
current_mapping = scope_mapping[bb]
1151+
if current_mapping != SSAValue(0)
1152+
if val == SSAValue(0)
1153+
# Unreachable bbs will have SSAValue(0), but can branch into
1154+
# try/catch regions. We could validate with the domtree, but that's
1155+
# quite expensive for a debug check, so simply allow this without
1156+
# making any changes to mapping.
1157+
return
1158+
end
1159+
@assert current_mapping == val
1160+
return
1161+
end
11511162
scope_mapping[bb] = val
11521163
end
11531164

0 commit comments

Comments
 (0)