[LVI] Extend select handling to catch min/max/clamp idioms
authorPhilip Reames <listmail@philipreames.com>
Fri, 26 Feb 2016 22:53:59 +0000 (22:53 +0000)
committerPhilip Reames <listmail@philipreames.com>
Fri, 26 Feb 2016 22:53:59 +0000 (22:53 +0000)
commitadf0e353088bb2f25cec0cd743e48a931e53255a
treed6b8b64f77eb2d34616579cca85a97319f17e504
parent66ff0756e421f0d702b1eeb8debee5c8903e1540
[LVI] Extend select handling to catch min/max/clamp idioms

Most of this is fairly straight forward. Add handling for min/max via existing matcher utility and ConstantRange routines.  Add handling for clamp by exploiting condition constraints on inputs.

Note that I'm only handling two constant ranges at this point. It would be reasonable to consider treating overdefined as a full range if the instruction is typed as an integer, but that should be a separate change.

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

llvm-svn: 262085
llvm/lib/Analysis/LazyValueInfo.cpp
llvm/test/Transforms/CorrelatedValuePropagation/basic.ll