Skip to content

Commit

Permalink
sroa: Relax scope assertion
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Keno committed Jan 12, 2024
1 parent c5d7b87 commit 73d6422
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion base/compiler/ssair/passes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,18 @@ function (this::IntermediaryCollector)(@nospecialize(pi), @nospecialize(ssa))
end

function update_scope_mapping!(scope_mapping, bb, val)
@assert (scope_mapping[bb] in (val, SSAValue(0)))
current_mapping = scope_mapping[bb]
if current_mapping != SSAValue(0)
if val == SSAValue(0)
# Unreachable bbs will have SSAValue(0), but can branch into
# try/catch regions. We could validate with the domtree, but that's
# quite expensive for a debug check, so simply allow this without
# making any changes to mapping.
return
end
@assert current_mapping == val
return
end
scope_mapping[bb] = val
end

Expand Down

0 comments on commit 73d6422

Please sign in to comment.