SCEV bottom value

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

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.

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

In my case, it indicates an unknown value. It's certainly a number of
some sort, but I can't prove anything about it (positive, negative,
size, etc). So I use this special indication to indicate I must make
worst-case assumptions. But, yes, I'd like it to work almost like a
floating-point NaN. The exception is that 0*magic should yield 0.

Preston