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

Further tweaks to LimitedAccuracy lattice operations #48126

Merged
merged 1 commit into from
Jan 22, 2023
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/typelattice.jl
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ function ⊑(lattice::InferenceLattice, @nospecialize(a), @nospecialize(b))

# a and b's unlimited types are equal.
isa(a, LimitedAccuracy) || return false # b is limited, so ε smaller
return a.causes ⊆ b.causes
return b.causes ⊆ a.causes
end

function ⊑(lattice::OptimizerLattice, @nospecialize(a), @nospecialize(b))
Expand Down
4 changes: 2 additions & 2 deletions base/compiler/typelimits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,7 @@ end

# Approximated types are lattice equal. Merge causes.
if suba && subb
causes = merge_causes(causesa, causesb)
issimplertype(lattice, typeb, typea) && return LimitedAccuracy(typeb, causesb)
return LimitedAccuracy(typeb, merge_causes(causesa, causesb))
elseif suba
issimplertype(lattice, typeb, typea) && return LimitedAccuracy(typeb, causesb)
causes = causesb
Expand Down Expand Up @@ -453,6 +452,7 @@ end
subb = ⊑(lattice, typeb, typea)
end

suba && subb && return LimitedAccuracy(typea, causes)
subb && issimplertype(lattice, typea, typeb) && return LimitedAccuracy(typea, causes)
return LimitedAccuracy(tmerge(widenlattice(lattice), typea, typeb), causes)
end
Expand Down