Skip to content
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 Compiler/src/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3255,7 +3255,7 @@ function abstract_eval_copyast(interp::AbstractInterpreter, e::Expr, sstate::Sta
return RTEffects(rt, Any, effects)
end

function abstract_eval_isdefined_expr(interp::AbstractInterpreter, e::Expr, sstate::StatementState,
function abstract_eval_isdefined_expr(::AbstractInterpreter, e::Expr, sstate::StatementState,
sv::AbsIntState)
sym = e.args[1]
if isa(sym, SlotNumber) && sstate.vtypes !== nothing
Expand Down
9 changes: 9 additions & 0 deletions Compiler/src/typelattice.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ struct Conditional
isdefined::Bool=false)
assert_nested_slotwrapper(thentype)
assert_nested_slotwrapper(elsetype)
if thentype isa LimitedAccuracy || elsetype isa LimitedAccuracy
return Bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically this is required to be a LimitedAccuracy(Bool) to prevent caching the bad result (same everywhere in this PR)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's necessary?
Conditional(slot, thentype, elsetype) does not represent the type of slot that can either be thentype or elsetype, but just represents the type of the condition. So I don't think we need to pass along the limited accuracy information coming along with thentype/elsetype.
MustAlias(slot, vartyp, fldidx, fldtyp) represents the type of fldtyp, but if fldtyp is LimitedAccuracy, it's returned unchanged.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LimitedAccuracy also doesn't represent the type of the slot, but rather represents that the computation of it was widened to be incomplete (exactly what happened here)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

end
return new(slot, thentype, elsetype, isdefined)
end
end
Expand Down Expand Up @@ -83,6 +86,9 @@ struct MustAlias
assert_nested_slotwrapper(fldtyp)
# @assert !isalreadyconst(vartyp) "vartyp is already const"
# @assert !isalreadyconst(fldtyp) "fldtyp is already const"
if vartyp isa LimitedAccuracy || fldtyp isa LimitedAccuracy
return fldtyp
end
return new(slot, vartyp, fldidx, fldtyp)
end
end
Expand All @@ -104,6 +110,9 @@ struct InterMustAlias
assert_nested_slotwrapper(fldtyp)
# @assert !isalreadyconst(vartyp) "vartyp is already const"
# @assert !isalreadyconst(fldtyp) "fldtyp is already const"
if vartyp isa LimitedAccuracy || fldtyp isa LimitedAccuracy
return fldtyp
end
return new(slot, vartyp, fldidx, fldtyp)
end
end
Expand Down