aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis/ValueTracking.cpp
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
commit464a4f349c95a25d06d709e79d7df21fbbb155e2 (patch)
tree64138b42f42f19719c229bd1237a006084fbfe6e /lib/Analysis/ValueTracking.cpp
parente19b7b80bd1bf48f9a6f036cf1cbc5f65445090a (diff)
downloadexternal_llvm-464a4f349c95a25d06d709e79d7df21fbbb155e2.zip
external_llvm-464a4f349c95a25d06d709e79d7df21fbbb155e2.tar.gz
external_llvm-464a4f349c95a25d06d709e79d7df21fbbb155e2.tar.bz2
APInt has a method for determining whether a number is a power of 2
which is more efficient than countPopulation - use it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124283 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ValueTracking.cpp')
-rw-r--r--lib/Analysis/ValueTracking.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp
index 5320fa0..aa7769e 100644
--- a/lib/Analysis/ValueTracking.cpp
+++ b/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