Get rvalue bounds for the value of lvalue expressions from the CheckingState #1183
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR modifies the way that rvalue bounds are determined for the value of a member expression, pointer deference, or array subscript to be consistent with the way that rvalue bounds are determined for the value of a variable. The rvalue bounds for the value of a variable, member expression, pointer dereference, or array subscript expression
e
are determined by looking at theObservedBounds
map in the checking state. If theAbstractSet
containinge
is present inObservedBounds
, then those are the bounds for the value ofe
. Otherwise, the bounds for the value ofe
default to the lvalue target bounds ofe
(or the lvalue bounds ofe
ife
is the subexpression of anArrayToPointerDecay
cast.One consequence of this change is that the order of expressions used to get or create an
AbstractSet
may differ, which may affect the representative expression for theAbstractSet
. For example, consider the assignment*p = p[0] + 1
. The rvalue bounds ofp[0]
are determined before modifying the observed bounds of*p
. This means thatp[0]
is the first expression that is used to create theAbstractSet
that contains*p
andp[0]
, sop[0]
is the representative expression for thisAbstractSet
.This PR also includes a minor fix in CanonBounds where
ExtVectorElementExprs
are compared by address. This prevents anllvm_unreachable
that would otherwise occur when creating anAbstractSet
for a member expression that contains anExtVectorElementExpr
.