Skip to content

Commit

Permalink
irinterp: Don't give bad answers on encountering try/catch (#52601)
Browse files Browse the repository at this point in the history
We generally don't model try/catch in irinterp, but let's at least add
the cases and make them do nothing, rather than assuming these nodes are
literals and giving bad type results.

Co-authored-by: Shuhei Kadowaki <[email protected]>
Co-authored-by: Oscar Smith <[email protected]>
  • Loading branch information
3 people authored Dec 21, 2023
1 parent bc979ae commit c1e1d5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/compiler/optimize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ function argextype(
return Const(x.value)
elseif isa(x, GlobalRef)
return abstract_eval_globalref_type(x)
elseif isa(x, PhiNode)
elseif isa(x, PhiNode) || isa(x, PhiCNode) || isa(x, UpsilonNode)
return Any
elseif isa(x, PiNode)
return x.typ
Expand Down
5 changes: 5 additions & 0 deletions base/compiler/ssair/irinterp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ function reprocess_instruction!(interp::AbstractInterpreter, inst::Instruction,
end
elseif isa(stmt, PhiNode)
rt = abstract_eval_phi_stmt(interp, stmt, idx, irsv)
elseif isa(stmt, UpsilonNode)
rt = argextype(stmt.val, irsv.ir)
elseif isa(stmt, PhiCNode)
# Currently not modeled
return false
elseif isa(stmt, ReturnNode)
# Handled at the very end
return false
Expand Down

0 comments on commit c1e1d5c

Please sign in to comment.