Skip to content

Commit

Permalink
we've never compared Conditional and InterConditional
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk committed Dec 19, 2020
1 parent b6bbf6a commit 889add5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions base/compiler/typelattice.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ const CompilerTypes = Union{MaybeUndef, Const, Conditional, NotFound, PartialStr
# lattice logic #
#################

function issubconditional(a::AnyConditional, b::AnyConditional)
# `Conditional` and `InterConditional` are valid in opposite contexts
# (i.e. local and interprocedural call), as such they will never be compared
function issubconditional(a::C, b::C) where {C<:AnyConditional}
if is_same_conditionals(a, b)
if a.vtype b.vtype
if a.elsetype b.elsetype
Expand All @@ -109,8 +111,6 @@ function issubconditional(a::AnyConditional, b::AnyConditional)
return false
end
is_same_conditionals(a::Conditional, b::Conditional) = slot_id(a.var) === slot_id(b.var)
is_same_conditionals(a::Conditional, b::InterConditional) = slot_id(a.var) === b.slot
is_same_conditionals(a::InterConditional, b::Conditional) = is_same_conditionals(b, a)
is_same_conditionals(a::InterConditional, b::InterConditional) = a.slot === b.slot

maybe_extract_const_bool(c::Const) = isa(c.val, Bool) ? c.val : nothing
Expand Down
2 changes: 1 addition & 1 deletion base/compiler/typelimits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ function tmerge(@nospecialize(typea), @nospecialize(typeb))
end
return Bool
end
# type-lattice for InterConditional wrapper, InterConditional won't be merged with Conditional
# type-lattice for InterConditional wrapper, InterConditional will never be merged with Conditional
if isa(typea, InterConditional) && isa(typeb, Const)
if typeb.val === true
typeb = InterConditional(typea.slot, Any, Union{})
Expand Down

0 comments on commit 889add5

Please sign in to comment.