summaryrefslogtreecommitdiffstats
path: root/llvm
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
commitb3949340c8856383ec3696bfa838dd3ae27ebc14 (patch)
tree877b18c8a2a6115dba1d2d48c3d9f861bb48603b /llvm
parentdd066c34a948d9984e15372e457e06c1ddd3c7c2 (diff)
downloadbcm5719-llvm-b3949340c8856383ec3696bfa838dd3ae27ebc14.tar.gz
bcm5719-llvm-b3949340c8856383ec3696bfa838dd3ae27ebc14.zip
Simplify isHighOnes().
llvm-svn: 35211
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp10
1 files changed, 1 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 287a0077ec6..891868b98a6 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud