[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Zhou Sheng
zhousheng00 at gmail.com
Tue Mar 20 05:49:28 PDT 2007
Changes in directory llvm/lib/Transforms/Scalar:
InstructionCombining.cpp updated: 1.669 -> 1.670
---
Log message:
Simplify isHighOnes().
---
Diffs of the changes: (+1 -9)
InstructionCombining.cpp | 10 +---------
1 files changed, 1 insertion(+), 9 deletions(-)
Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.669 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.670
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.669 Mon Mar 19 19:16:52 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Mar 20 07:49:06 2007
@@ -3491,15 +3491,7 @@
// 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
More information about the llvm-commits
mailing list