[llvm-dev] LazyValueInfo vs ScalarEvolution

Hongbin Zheng via llvm-dev llvm-dev at lists.llvm.org
Mon Jul 24 15:16:57 PDT 2017

On Mon, Jul 24, 2017 at 3:08 PM, John Regehr <regehr at cs.utah.edu> wrote:

> Also I should add that I strongly doubt that it will be acceptable to
> simply call ScalarEvolution's integer range analysis from LVI. The right
> answer is no doubt more nuanced and the actual experts in this stuff are
> here and hopefully they can chime in with opinions.

It looks like in LazyValueInfoCache::solveBlockValuePHINode we only get the
upper bound of the PHINode in the above example in getEdgeValue.
Thus it generates range like constantrange<-2147483648 <(214)%20748-3648>,

In order to also get the lower bound, we need to prove the PN is is
monotonically increasing. And such code had been implemented in SCEV. Maybe
we could factor these code out and use them in both LVI and SCEV.

> Also, I am hoping to get together with a few people who care about LVI at
> the October dev meeting, you should join if you are going to attend.


> John
> On 07/24/2017 03:59 PM, John Regehr wrote:
>> On 07/24/2017 03:43 PM, Hongbin Zheng wrote:
>>>     Also, the last time I looked, there seemed to be a fair amount of
>>>     room for improvement in LVI and ConstantRange.
>>> Could you point some out?
>> Check out the TODO items in binaryAnd and BinaryOr in ConstantRange.cpp.
>> There are some missing cases in the switch in ConstantRange::binaryOp,
>> such as xor and ashr.
>> Argh this is embarrassing, I have some unfinished work sitting in
>> Phabricator that could use a helper if you have time to take a look:
>> https://reviews.llvm.org/D19859
>> https://reviews.llvm.org/D20669
>> https://reviews.llvm.org/D19867
>> https://reviews.llvm.org/D19559
>> John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170724/e33b598d/attachment.html>

More information about the llvm-dev mailing list