Make isOneBitSet faster by using APInt::isPowerOf2. Thanks Chris.
authorReid Spencer <rspencer@reidspencer.com>
Tue, 20 Mar 2007 00:16:52 +0000 (00:16 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Tue, 20 Mar 2007 00:16:52 +0000 (00:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35194 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/InstructionCombining.cpp

index c87a351e63bc03ab110c2d32d2e58644032e6445..287a0077ec6c35f1981d71532c766c614b36ea53 100644 (file)
@@ -3472,7 +3472,7 @@ static bool isMinValuePlusOne(const ConstantInt *C, bool isSigned) {
 // isOneBitSet - Return true if there is exactly one bit set in the specified
 // constant.
 static bool isOneBitSet(const ConstantInt *CI) {
-  return CI->getValue().countPopulation() == 1;
+  return CI->getValue().isPowerOf2();
 }
 
 #if 0   // Currently unused