summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2011-01-26 08:44:16 +0000
committerDuncan Sands <baldrick@free.fr>2011-01-26 08:44:16 +0000
commit8a33733228db5a21b16e0532d5b2e0bae011a33a (patch)
tree0d5a200cc0f108a2c7b08d940e1855f7b9b9dd58
parentd9e6b4a8ff25a2756c438edbec2114797fc280f3 (diff)
downloadbcm5719-llvm-8a33733228db5a21b16e0532d5b2e0bae011a33a.tar.gz
bcm5719-llvm-8a33733228db5a21b16e0532d5b2e0bae011a33a.zip
APInt has a method for determining whether a number is a power of 2
which is more efficient than countPopulation - use it. llvm-svn: 124283
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 5320fa0768d..aa7769ea545 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -656,7 +656,7 @@ void llvm::ComputeSignBit(Value *V, bool &KnownZero, bool &KnownOne,
/// types and vectors of integers.
bool llvm::isPowerOfTwo(Value *V, const TargetData *TD, unsigned Depth) {
if (ConstantInt *CI = dyn_cast<ConstantInt>(V))
- return CI->getValue().countPopulation() == 1;
+ return CI->getValue().isPowerOf2();
// TODO: Handle vector constants.
// 1 << X is clearly a power of two if the one is not shifted off the end. If
OpenPOWER on IntegriCloud