Skip to content

Conditional lattice element is semantically broken in the presence of SSAValues #55548

@Keno

Description

@Keno

Ooops:

julia> proj1(a, b) = a
proj1 (generic function with 2 methods)

julia> function foo(a)
           a = Base.inferencebarrier(a)::Union{Int64, Float64}
           if proj1(isa(a, Int64), (a = Base.inferencebarrier(1.0)::Union{Int64, Float64}; true))
                          return a
           end
           return 2
       end
foo (generic function with 2 methods)

julia> foo(1)
4607182418800017408

Basically, this code doesn't know about SSAValues:

function invalidate_slotwrapper(vt::VarState, changeid::Int, ignore_conditional::Bool)
newtyp = ignorelimited(vt.typ)
if (!ignore_conditional && isa(newtyp, Conditional) && newtyp.slot == changeid) ||
(isa(newtyp, MustAlias) && newtyp.slot == changeid)
newtyp = @noinline widenwrappedslotwrapper(vt.typ)
return VarState(newtyp, vt.undef)
end
return nothing
end

But it's not clear what a sound way to change that is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorcompiler:inferenceType inference

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions