Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inference: add missing MustAlias widening in _getfield_tfunc #54996

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion base/compiler/tfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ end
end

@nospecs function _getfield_tfunc(𝕃::AnyMustAliasesLattice, s00, name, setfield::Bool)
return _getfield_tfunc(widenlattice(𝕃), widenmustalias(s00), name, setfield)
return _getfield_tfunc(widenlattice(𝕃), widenmustalias(s00), widenmustalias(name), setfield)
end

@nospecs function _getfield_tfunc(𝕃::PartialsLattice, s00, name, setfield::Bool)
Expand Down
8 changes: 8 additions & 0 deletions test/compiler/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2565,6 +2565,14 @@ Base.return_types(intermustalias_edgecase, (Any,); interp=MustAliasInterpreter()
intermustalias_edgecase(x)
end |> only === Core.Compiler.InterMustAlias

@test Base.infer_return_type((AliasableField,Integer,); interp=MustAliasInterpreter()) do a, x
s = (;x)
if getfield(a, :f) isa Symbol
return getfield(s, getfield(a, :f))
end
return 0
end == Integer

function f25579(g)
h = g[]
t = (h === nothing)
Expand Down