Add handling for range metadata in ValueTracking isKnownNonZero
authorPhilip Reames <listmail@philipreames.com>
Thu, 30 Oct 2014 20:25:19 +0000 (20:25 +0000)
committerPhilip Reames <listmail@philipreames.com>
Thu, 30 Oct 2014 20:25:19 +0000 (20:25 +0000)
commitaad4ea476e9cb40e40fdb2c48aab86587a4d5c84
treee4787a5939beba80bc202bd42a1186d1208978ef
parent6c5d2989be23a9c071314c3c001563751dd2be25
Add handling for range metadata in ValueTracking isKnownNonZero

If we load from a location with range metadata, we can use information about the ranges of the loaded value for optimization purposes.  This helps to remove redundant checks and canonicalize checks for other optimization passes.  This particular patch checks whether a value is known to be non-zero from the range metadata.

Currently, these tests are against InstCombine.  In theory, all of these should be InstSimplify since we're not inserting any new instructions.  Moving the code may follow in a separate change.

Reviewed by: Hal
Differential Revision: http://reviews.llvm.org/D5947

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220925 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ValueTracking.cpp
test/Transforms/InstCombine/icmp-range.ll [new file with mode: 0644]