[LLVMdev] SCEV bottom value
Sameer Sahasrabuddhe
sameer.sahasrabuddhe at amd.com
Sun Oct 7 20:45:46 PDT 2012
On Sun, 7 Oct 2012 18:53:59 -0700
Preston Briggs <preston.briggs at gmail.com> wrote:
> I'd like a value, call it Bottom, such that
>
> SE->getAddExpr(Bottom, X) => Bottom
> SE->getMulExpr(Bottom, X,) => Bottom
> isKnownPredicate(any, Bottom, X) => false
> etc.
>
>
> I can write code to make NULL work like I want, but it would be
> simpler if something was already defined. I'm wondering about
> SCEV::Unknown. The documentation suggests I could perhaps use it for
> a "bottom" value.
>
> Think it would work?
The documentation definitely says that SCEVUnknown is the "bottom"
value. But the semantics you have listed here are different from how
SCEVUnknown works. For example, B = A + Unknown is not Unknown, but it
is in fact an add expression. If B is an operand for another add
expression C, then it can be flattened so that A participates in any
folding happening for C. But instead, if B was the expression A +
Bottom, then B would become bottom, and so would C, and no folding will
ever be allowed.
In some sense, Bottom is the anti-thesis to Unknown. Unknown provides
a boundary that encapsulates unknown semantics, while Bottom
invalidates anything it touches!
Also, how would one uniquify Bottom expressions? Should they all be
considered identical?
Sameer.
More information about the llvm-dev
mailing list