[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Reid Spencer reid at x10sys.com
Mon Mar 19 14:05:00 PDT 2007



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.664 -> 1.665
---
Log message:

Implement isOneBitSet in terms of APInt::countPopulation.


---
Diffs of the changes:  (+1 -2)

 InstructionCombining.cpp |    3 +--
 1 files changed, 1 insertion(+), 2 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.664 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.665
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.664	Mon Mar 19 15:58:18 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Mon Mar 19 16:04:43 2007
@@ -3474,8 +3474,7 @@
 // isOneBitSet - Return true if there is exactly one bit set in the specified
 // constant.
 static bool isOneBitSet(const ConstantInt *CI) {
-  uint64_t V = CI->getZExtValue();
-  return V && (V & (V-1)) == 0;
+  return CI->getValue().countPopulation() == 1;
 }
 
 #if 0   // Currently unused






More information about the llvm-commits mailing list