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
/// 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