Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle PhiNode with edge==0 #46388

Merged
merged 1 commit into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion base/compiler/ssair/legacy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function replace_code_newstyle!(ci::CodeInfo, ir::IRCode, nargs::Int)
elseif isa(stmt, GotoIfNot)
code[i] = GotoIfNot(stmt.cond, first(ir.cfg.blocks[stmt.dest].stmts))
elseif isa(stmt, PhiNode)
code[i] = PhiNode(Int32[last(ir.cfg.blocks[edge].stmts) for edge in stmt.edges], stmt.values)
code[i] = PhiNode(Int32[edge == 0 ? 0 : last(ir.cfg.blocks[edge].stmts) for edge in stmt.edges], stmt.values)
elseif isexpr(stmt, :enter)
stmt.args[1] = first(ir.cfg.blocks[stmt.args[1]::Int].stmts)
code[i] = stmt
Expand Down
12 changes: 12 additions & 0 deletions test/compiler/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4111,3 +4111,15 @@ struct Issue45780
end
f45780() = Val{Issue45780(@Base.Experimental.opaque ()->1).oc()}()
@test (@inferred f45780()) == Val{1}()

# issue #45600
@test only(code_typed() do
while true
x = try finally end
end
end)[2] == Union{}
@test only(code_typed() do
while true
@time 1
end
end)[2] == Union{}