[llvm-commits] [llvm] r124283 - /llvm/trunk/lib/Analysis/ValueTracking.cpp
Duncan Sands
baldrick at free.fr
Wed Jan 26 00:44:16 PST 2011
Author: baldrick
Date: Wed Jan 26 02:44:16 2011
New Revision: 124283
URL: http://llvm.org/viewvc/llvm-project?rev=124283&view=rev
Log:
APInt has a method for determining whether a number is a power of 2
which is more efficient than countPopulation - use it.
Modified:
llvm/trunk/lib/Analysis/ValueTracking.cpp
Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=124283&r1=124282&r2=124283&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Wed Jan 26 02:44:16 2011
@@ -656,7 +656,7 @@
/// 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
More information about the llvm-commits
mailing list