Skip to content

Commit b52e664

Browse files
committed
more symbolism
1 parent 5ce1e70 commit b52e664

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

base/compiler/abstractinterpretation.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,9 @@ function from_interconditional(@nospecialize(typ), (; fargs, argtypes)::ArgInfo,
345345
else
346346
elsetype = tmeet(elsetype, widenconst(new_elsetype))
347347
end
348-
if (slot > 0 || condval !== false) && !(old vtype) # essentially vtype ⋤ old
348+
if (slot > 0 || condval !== false) && vtype old
349349
slot = id
350-
elseif (slot > 0 || condval !== true) && !(old elsetype) # essentially elsetype ⋤ old
350+
elseif (slot > 0 || condval !== true) && elsetype old
351351
slot = id
352352
else # reset: no new useful information for this slot
353353
vtype = elsetype = Any
@@ -1605,7 +1605,7 @@ function abstract_eval_statement(interp::AbstractInterpreter, @nospecialize(e),
16051605
at = widenconditional(abstract_eval_value(interp, e.args[i], vtypes, sv))
16061606
if !anyrefine
16071607
anyrefine = has_nontrivial_const_info(at) || # constant information
1608-
at fieldtype(t, i - 1) # just a type-level information, but more precise than the declared type
1608+
at fieldtype(t, i - 1) # just a type-level information, but more precise than the declared type
16091609
end
16101610
ats[i-1] = at
16111611
if at === Bottom
@@ -1808,7 +1808,7 @@ function widenreturn(@nospecialize(rt), @nospecialize(bestguess), nslots::Int, s
18081808
if !anyrefine
18091809
# TODO: consider adding && const_prop_profitable(a) here?
18101810
anyrefine = has_const_info(a) ||
1811-
a fieldtype(rt.typ, i)
1811+
a fieldtype(rt.typ, i)
18121812
end
18131813
fields[i] = a
18141814
end

base/compiler/typelattice.jl

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,12 @@ function maybe_extract_const_bool(c::AnyConditional)
140140
end
141141
maybe_extract_const_bool(@nospecialize c) = nothing
142142

143-
function (@nospecialize(a), @nospecialize(b))
143+
"""
144+
a ⊑ b -> Bool
145+
146+
The non-strict partial order over the type inference lattice.
147+
"""
148+
@nospecialize(a) @nospecialize(b) = begin
144149
if isa(b, LimitedAccuracy)
145150
if !isa(a, LimitedAccuracy)
146151
return false
@@ -231,7 +236,22 @@ function ⊑(@nospecialize(a), @nospecialize(b))
231236
return a === b
232237
end
233238
end
234-
(@nospecialize(a), @nospecialize(b)) = !(b, a)
239+
240+
"""
241+
a ⊏ b -> Bool
242+
243+
The strict partial order over the type inference lattice.
244+
This is defined as the irreflexive kernel of `⊑`.
245+
"""
246+
@nospecialize(a) @nospecialize(b) = a b && !(b, a)
247+
248+
"""
249+
a ⋤ b -> Bool
250+
251+
This order could be used as a slightly more efficient version of the strict order `⊏`,
252+
where we can safely assume `a ⊑ b` holds.
253+
"""
254+
@nospecialize(a) @nospecialize(b) = !(b, a)
235255

236256
# Check if two lattice elements are partial order equivalent. This is basically
237257
# `a ⊑ b && b ⊑ a` but with extra performance optimizations.

0 commit comments

Comments
 (0)