Skip to content

Commit c8f6e0c

Browse files
aviateskKristofferC
authored andcommitted
inference: yet more fix for ifelse lattice (#39247)
(cherry picked from commit 5bb0659)
1 parent 317badd commit c8f6e0c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

base/compiler/abstractinterpretation.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -792,13 +792,13 @@ function abstract_call_builtin(interp::AbstractInterpreter, f::Builtin, fargs::U
792792
cnd = argtypes[2]
793793
if isa(cnd, Conditional)
794794
newcnd = widenconditional(cnd)
795+
tx = argtypes[3]
796+
ty = argtypes[4]
795797
if isa(newcnd, Const)
796798
# if `cnd` is constant, we should just respect its constantness to keep inference accuracy
797-
return newcnd.val ? tx : ty
799+
return newcnd.val::Bool ? tx : ty
798800
else
799801
# try to simulate this as a real conditional (`cnd ? x : y`), so that the penalty for using `ifelse` instead isn't too high
800-
tx = argtypes[3]
801-
ty = argtypes[4]
802802
a = ssa_def_slot(fargs[3], sv)
803803
b = ssa_def_slot(fargs[4], sv)
804804
if isa(a, Slot) && slot_id(cnd.var) == slot_id(a)

0 commit comments

Comments
 (0)