[LLVMdev] GSoC - Range Analysis

John Regehr regehr at cs.utah.edu
Tue Apr 3 11:12:53 PDT 2012


> Is this really true?  For example, suppose you know that X is in the range
> [1, +inf], and now you calculate Y = 1 / X, then you get that Y is in the
> range [0, 1].  But there is no guarantee that Y is really in that range:
> since X might have overflowed it might for example be equal to -1, in which
> case Y would be equal to -1 too, outside the range [0, 1].  In short, I doubt
> you can conclude that a variable Y is really in a range [c1, c2] just from 
> the
> information that c1 > -inf and c2 < +inf.  I think you also need to look at 
> the
> history of how you got there.

Duncan these problems can definitely be solved.  In your example, we would 
need to have avoided giving X the wrong interval value in the first place.

The problem with overflow isn't that it makes sound analysis impossible, 
it's that it can kill precision.

Here's GCC's value range propagation module, which is definitely intended 
to be sound since it feeds the optimizer:

   http://gcc.gnu.org/svn/gcc/trunk/gcc/tree-vrp.c

John



More information about the llvm-dev mailing list