[LVI] Improve select handling to use condition
authorPhilip Reames <listmail@philipreames.com>
Fri, 12 Feb 2016 00:09:18 +0000 (00:09 +0000)
committerPhilip Reames <listmail@philipreames.com>
Fri, 12 Feb 2016 00:09:18 +0000 (00:09 +0000)
commit854a84c0b0a3386943bdc6bf67d8f2e36c4496db
tree46c06bf1897b87d63b2f63e863407c632f840ab3
parent9ddad935b93906f8b0389b9120ce29ff0206585f
[LVI] Improve select handling to use condition

This patches teaches LVI to recognize clamp idioms (e.g. select(a > 5, a, 5) will always produce something greater than 5.

The tests end up being somewhat simplistic because trying to exercise the case I actually care about (a loop with a range check on a clamped secondary induction variable) ends up tripping across a couple of other imprecisions in the analysis. Ah, the joys of LVI...

Differential Revision: http://reviews.llvm.org/D16827

llvm-svn: 260627
llvm/lib/Analysis/LazyValueInfo.cpp
llvm/test/Transforms/CorrelatedValuePropagation/select.ll