Skip to content

Commit

Permalink
inlining: Use tfunc for inserted isa/and calls
Browse files Browse the repository at this point in the history
The motivation for this is the same as JuliaLang#54105, where the return types
being filled in by inference can in general be imprecise when running
the compiler with an extended lattice.

This PR is very incomplete - There are at least 6+ more places in
`inlining.jl` where we hard-code return types that will need similar
treatment.
  • Loading branch information
topolarity committed Apr 22, 2024
1 parent 4a4d850 commit 32411a0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions base/compiler/ssair/inlining.jl
Expand Up @@ -545,12 +545,14 @@ function ir_inline_unionsplit!(compact::IncrementalCompact, idx::Int, argexprs::
aft <: mft && continue
# Generate isa check
isa_expr = Expr(:call, isa, argexprs[i], mft)
ssa = insert_node_here!(compact, NewInstruction(isa_expr, Bool, line))
isa_type = isa_tfunc(optimizer_lattice(interp), argextype(argexprs[i], compact), Const(mft))
ssa = insert_node_here!(compact, NewInstruction(isa_expr, isa_type, line))
if cond === true
cond = ssa
else
and_expr = Expr(:call, and_int, cond, ssa)
cond = insert_node_here!(compact, NewInstruction(and_expr, Bool, line))
and_type = and_int_tfunc(optimizer_lattice(interp), argextype(cond, compact), isa_type)
cond = insert_node_here!(compact, NewInstruction(and_expr, and_type, line))
end
end
insert_node_here!(compact, NewInstruction(GotoIfNot(cond, next_cond_bb), Union{}, line))
Expand Down

0 comments on commit 32411a0

Please sign in to comment.