Commit 2775c9a
authored
Fix handling of virtual exit node in
This is an alternative to #53642
The `dom_edges()` for an exit block in the CFG are empty when computing
the PostDomTree so the loop below this may not actually run. In that
case, the right semidominator is the ancestor from the DFSTree, which is
the "virtual" -1 block.
This resolves half of the issue in
#53613:
```julia
julia> let code = Any[
# block 1
GotoIfNot(Argument(2), 3),
# block 2
ReturnNode(Argument(3)),
# block 3 (we should visit this block)
Expr(:call, throw, "potential throw"),
ReturnNode(), # unreachable
]
ir = make_ircode(code; slottypes=Any[Any,Bool,Bool])
visited = BitSet()
@test !Core.Compiler.visit_conditional_successors(CC.LazyPostDomtree(ir), ir, #=bb=#1) do succ::Int
push!(visited, succ)
return false
end
@test 2 ∈ visited
@test 3 ∈ visited
end
Test Passed
```
This needs some tests (esp. since I don't think we have any DomTree
tests at all right now), but otherwise should be good to go.PostDomTree (#53739)1 parent 8f76c69 commit 2775c9a
1 file changed
+1
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
| 348 | + | |
352 | 349 | | |
353 | 350 | | |
354 | 351 | | |
| |||
0 commit comments