Skip to content

Commit 9ab08b3

Browse files
martinholtersstaticfloat
authored andcommitted
Handle PhiNode with edge==0 (#46388)
(cherry picked from commit fd66c30)
1 parent 065a117 commit 9ab08b3

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

base/compiler/ssair/legacy.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function replace_code_newstyle!(ci::CodeInfo, ir::IRCode, nargs::Int)
5959
elseif isa(stmt, GotoIfNot)
6060
stmt = GotoIfNot(stmt.cond, first(ir.cfg.blocks[stmt.dest].stmts))
6161
elseif isa(stmt, PhiNode)
62-
stmt = PhiNode(Int32[last(ir.cfg.blocks[edge].stmts) for edge in stmt.edges], stmt.values)
62+
stmt = PhiNode(Int32[edge == 0 ? 0 : last(ir.cfg.blocks[edge].stmts) for edge in stmt.edges], stmt.values)
6363
elseif isa(stmt, Expr) && stmt.head === :enter
6464
stmt.args[1] = first(ir.cfg.blocks[stmt.args[1]::Int].stmts)
6565
end

test/compiler/inference.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3090,3 +3090,15 @@ end
30903090
f41908(x::Complex{T}) where {String<:T<:String} = 1
30913091
g41908() = f41908(Any[1][1])
30923092
@test only(Base.return_types(g41908, ())) <: Int
3093+
3094+
# issue #45600
3095+
@test only(code_typed() do
3096+
while true
3097+
x = try finally end
3098+
end
3099+
end)[2] == Union{}
3100+
@test only(code_typed() do
3101+
while true
3102+
@time 1
3103+
end
3104+
end)[2] == Union{}

0 commit comments

Comments
 (0)