Skip to content

Commit b63ae3b

Browse files
authored
Forbid InterConditional in PartialStruct fields (#44438)
Alternative to #44437.
1 parent 8c4ff55 commit b63ae3b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

base/compiler/abstractinterpretation.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2068,14 +2068,18 @@ function widenreturn(@nospecialize(rt), @nospecialize(bestguess), nslots::Int, s
20682068
# and is valid and good inter-procedurally
20692069
isa(rt, Conditional) && return InterConditional(slot_id(rt.var), rt.vtype, rt.elsetype)
20702070
isa(rt, InterConditional) && return rt
2071+
return widenreturn_noconditional(rt)
2072+
end
2073+
2074+
function widenreturn_noconditional(@nospecialize(rt))
20712075
isa(rt, Const) && return rt
20722076
isa(rt, Type) && return rt
20732077
if isa(rt, PartialStruct)
20742078
fields = copy(rt.fields)
20752079
local anyrefine = false
20762080
for i in 1:length(fields)
20772081
a = fields[i]
2078-
a = isvarargtype(a) ? a : widenreturn(a, bestguess, nslots, slottypes, changes)
2082+
a = isvarargtype(a) ? a : widenreturn_noconditional(widenconditional(a))
20792083
if !anyrefine
20802084
# TODO: consider adding && const_prop_profitable(a) here?
20812085
anyrefine = has_const_info(a) ||
@@ -2091,6 +2095,7 @@ function widenreturn(@nospecialize(rt), @nospecialize(bestguess), nslots::Int, s
20912095
return widenconst(rt)
20922096
end
20932097

2098+
20942099
function handle_control_backedge!(frame::InferenceState, from::Int, to::Int)
20952100
if from > to
20962101
if is_effect_overrided(frame, :terminates_globally)

0 commit comments

Comments
 (0)