summaryrefslogtreecommitdiffstats
path: root/lib/Transforms
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-03-19 21:04:43 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-03-19 21:04:43 +0000
commit44e33e674ad560b6e6d063a930e7af6d846fb0eb (patch)
tree7270dbf89fc8e2e530337fbfbb819bf49da6a819 /lib/Transforms
parent5a1e3e1a7d08b1baaf8971be69e2c8862a581985 (diff)
downloadexternal_llvm-44e33e674ad560b6e6d063a930e7af6d846fb0eb.zip
external_llvm-44e33e674ad560b6e6d063a930e7af6d846fb0eb.tar.gz
external_llvm-44e33e674ad560b6e6d063a930e7af6d846fb0eb.tar.bz2
Implement isOneBitSet in terms of APInt::countPopulation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35186 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index e38622a..dbe694f 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -3474,8 +3474,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) {
- uint64_t V = CI->getZExtValue();
- return V && (V & (V-1)) == 0;
+ return CI->getValue().countPopulation() == 1;
}
#if 0 // Currently unused