[LLVMdev] SCEV bottom value

Preston Briggs preston.briggs at gmail.com
Sun Oct 7 23:02:07 PDT 2012


On Sun, Oct 7, 2012 at 8:45 PM, Sameer Sahasrabuddhe
<sameer.sahasrabuddhe at amd.com> wrote:
>
> 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?

Sure. I just want one value that behaves as above. Since Unknown won't
do it for me, I'll just use NULL and code around the problem. Indeed,
I wrote it that way in the first place. This Bottom idea just occurred
to me as a way to simplify my implementation.

Thanks,
Preston



More information about the llvm-dev mailing list