diff options
author | Duncan Sands <baldrick@free.fr> | 2011-01-25 09:38:29 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2011-01-25 09:38:29 +0000 |
commit | d70d1a5c44609af091f6fc3e29193f9f4756a74f (patch) | |
tree | f55820e9c5f1f0b21e9ac628664a25dbd6bcbc1e /include/llvm/Analysis/ValueTracking.h | |
parent | b38824f866447ccf8dd0c76656755b05bcede1b1 (diff) | |
download | llvm-d70d1a5c44609af091f6fc3e29193f9f4756a74f.tar.gz llvm-d70d1a5c44609af091f6fc3e29193f9f4756a74f.tar.bz2 llvm-d70d1a5c44609af091f6fc3e29193f9f4756a74f.tar.xz |
According to my auto-simplifier the most common missed simplifications in
optimized code are:
(non-negative number)+(power-of-two) != 0 -> true
and
(x | 1) != 0 -> true
Instcombine knows about the second one of course, but only does it if X|1
has only one use. These fire thousands of times in the testsuite.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124183 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/ValueTracking.h')
-rw-r--r-- | include/llvm/Analysis/ValueTracking.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/llvm/Analysis/ValueTracking.h b/include/llvm/Analysis/ValueTracking.h index 2b3176dca2..6df1693c78 100644 --- a/include/llvm/Analysis/ValueTracking.h +++ b/include/llvm/Analysis/ValueTracking.h @@ -39,6 +39,23 @@ namespace llvm { APInt &KnownOne, const TargetData *TD = 0, unsigned Depth = 0); + /// ComputeSignBit - Determine whether the sign bit is known to be zero or + /// one. Convenience wrapper around ComputeMaskedBits. + void ComputeSignBit(Value *V, bool &KnownZero, bool &KnownOne, + const TargetData *TD = 0, unsigned Depth = 0); + + /// isPowerOfTwo - Return true if the given value is known to have exactly one + /// bit set when defined. For vectors return true if every element is known to + /// be a power of two when defined. Supports values with integer or pointer + /// type and vectors of integers. + bool isPowerOfTwo(Value *V, const TargetData *TD = 0, unsigned Depth = 0); + + /// isKnownNonZero - Return true if the given value is known to be non-zero + /// when defined. For vectors return true if every element is known to be + /// non-zero when defined. Supports values with integer or pointer type and + /// vectors of integers. + bool isKnownNonZero(Value *V, const TargetData *TD = 0, unsigned Depth = 0); + /// MaskedValueIsZero - Return true if 'V & Mask' is known to be zero. We use /// this predicate to simplify operations downstream. Mask is known to be /// zero for bits that V cannot have. |