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? Thanks, Preston -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121007/a31cd974/attachment.html>
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.
Hi Preston, I was wondering ... "Bottom" is a bit overloaded as far as terms go. Would SCEVNaN be a better name for this beast? Sameer.> -----Original Message----- > From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On > Behalf Of Sameer Sahasrabuddhe > Sent: Monday, October 08, 2012 9:16 AM > To: preston.briggs at gmail.com > Cc: LLVM Developers Mailing List > Subject: Re: [LLVMdev] SCEV bottom value > > 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. > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
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