Skip to content

Commit c38e7cd

Browse files
authored
inlining: Use tfunc for inserted isa/and calls (#54209)
The motivation for this is the same as #54105, where the return types being filled in by inference can in general be imprecise when running the compiler with an extended lattice. Note that 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, but for now this resolves some downstream bugs from these imprecise types.
1 parent e644ebd commit c38e7cd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

base/compiler/ssair/inlining.jl

+4-2
Original file line numberDiff line numberDiff line change
@@ -545,12 +545,14 @@ function ir_inline_unionsplit!(compact::IncrementalCompact, idx::Int, argexprs::
545545
aft <: mft && continue
546546
# Generate isa check
547547
isa_expr = Expr(:call, isa, argexprs[i], mft)
548-
ssa = insert_node_here!(compact, NewInstruction(isa_expr, Bool, line))
548+
isa_type = isa_tfunc(optimizer_lattice(interp), argextype(argexprs[i], compact), Const(mft))
549+
ssa = insert_node_here!(compact, NewInstruction(isa_expr, isa_type, line))
549550
if cond === true
550551
cond = ssa
551552
else
552553
and_expr = Expr(:call, and_int, cond, ssa)
553-
cond = insert_node_here!(compact, NewInstruction(and_expr, Bool, line))
554+
and_type = and_int_tfunc(optimizer_lattice(interp), argextype(cond, compact), isa_type)
555+
cond = insert_node_here!(compact, NewInstruction(and_expr, and_type, line))
554556
end
555557
end
556558
insert_node_here!(compact, NewInstruction(GotoIfNot(cond, next_cond_bb), Union{}, line))

0 commit comments

Comments
 (0)