aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorZhou Sheng <zhousheng00@gmail.com>2007-03-20 12:49:06 +0000
committerZhou Sheng <zhousheng00@gmail.com>2007-03-20 12:49:06 +0000
commit2cde46cb6645569db996b303716080a92bbdfa9b (patch)
tree2cbfff1cbcc9da175bf3adec4a82831897d90a71 /lib
parent07073e5f70e2146583980aebb0804b82fe6581a2 (diff)
downloadexternal_llvm-2cde46cb6645569db996b303716080a92bbdfa9b.zip
external_llvm-2cde46cb6645569db996b303716080a92bbdfa9b.tar.gz
external_llvm-2cde46cb6645569db996b303716080a92bbdfa9b.tar.bz2
Simplify isHighOnes().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35211 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp10
1 files changed, 1 insertions, 9 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 287a007..891868b 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -3491,15 +3491,7 @@ static bool isLowOnes(const ConstantInt *CI) {
// isHighOnes - Return true if the constant is of the form 1+0+.
// This is the same as lowones(~X).
static bool isHighOnes(const ConstantInt *CI) {
- if (CI->getValue() == 0) return false; // 0's does not match "1+"
-
- APInt V(~CI->getValue());
-
- // There won't be bits set in parts that the type doesn't contain.
- V &= APInt::getAllOnesValue(CI->getType()->getBitWidth());
-
- APInt U(V+1); // If it is low ones, this should be a power of two.
- return (U!=0) && (V!=0) && (U & V) == 0;
+ return (~CI->getValue() + 1).isPowerOf2();
}
/// getICmpCode - Encode a icmp predicate into a three bit mask. These bits