Skip to content

Commit

Permalink
Forbid InterConditional in PartialStruct fields (#44438)
Browse files Browse the repository at this point in the history
Alternative to #44437.
  • Loading branch information
Keno authored Mar 4, 2022
1 parent 8c4ff55 commit b63ae3b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion base/compiler/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2068,14 +2068,18 @@ function widenreturn(@nospecialize(rt), @nospecialize(bestguess), nslots::Int, s
# and is valid and good inter-procedurally
isa(rt, Conditional) && return InterConditional(slot_id(rt.var), rt.vtype, rt.elsetype)
isa(rt, InterConditional) && return rt
return widenreturn_noconditional(rt)
end

function widenreturn_noconditional(@nospecialize(rt))
isa(rt, Const) && return rt
isa(rt, Type) && return rt
if isa(rt, PartialStruct)
fields = copy(rt.fields)
local anyrefine = false
for i in 1:length(fields)
a = fields[i]
a = isvarargtype(a) ? a : widenreturn(a, bestguess, nslots, slottypes, changes)
a = isvarargtype(a) ? a : widenreturn_noconditional(widenconditional(a))
if !anyrefine
# TODO: consider adding && const_prop_profitable(a) here?
anyrefine = has_const_info(a) ||
Expand All @@ -2091,6 +2095,7 @@ function widenreturn(@nospecialize(rt), @nospecialize(bestguess), nslots::Int, s
return widenconst(rt)
end


function handle_control_backedge!(frame::InferenceState, from::Int, to::Int)
if from > to
if is_effect_overrided(frame, :terminates_globally)
Expand Down

0 comments on commit b63ae3b

Please sign in to comment.