summaryrefslogtreecommitdiff
path: root/lib/Analysis/ScalarEvolution.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2013-07-11 16:05:50 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2013-07-11 16:05:50 +0000
commit0a230e0d985625a3909cb78fd867a3abaf434565 (patch)
tree5781d89cdddab939dca31f5f5a62c2a1f825b22f /lib/Analysis/ScalarEvolution.cpp
parent1b3e3eef1fb51ace32b32e5ca217dacb03333b13 (diff)
downloadllvm-0a230e0d985625a3909cb78fd867a3abaf434565.tar.gz
llvm-0a230e0d985625a3909cb78fd867a3abaf434565.tar.bz2
llvm-0a230e0d985625a3909cb78fd867a3abaf434565.tar.xz
Don't use a potentially expensive shift if all we want is one set bit.
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186095 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolution.cpp')
-rw-r--r--lib/Analysis/ScalarEvolution.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index af5051650e..1d5e5fb719 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -758,7 +758,7 @@ static const SCEV *BinomialCoefficient(const SCEV *It, unsigned K,
unsigned CalculationBits = W + T;
// Calculate 2^T, at width T+W.
- APInt DivFactor = APInt(CalculationBits, 1).shl(T);
+ APInt DivFactor = APInt::getOneBitSet(CalculationBits, T);
// Calculate the multiplicative inverse of K! / 2^T;
// this multiplication factor will perform the exact division by
@@ -3789,7 +3789,7 @@ const SCEV *ScalarEvolution::createSCEV(Value *V) {
break;
Constant *X = ConstantInt::get(getContext(),
- APInt(BitWidth, 1).shl(SA->getZExtValue()));
+ APInt::getOneBitSet(BitWidth, SA->getZExtValue()));
return getMulExpr(getSCEV(U->getOperand(0)), getSCEV(X));
}
break;
@@ -3807,7 +3807,7 @@ const SCEV *ScalarEvolution::createSCEV(Value *V) {
break;
Constant *X = ConstantInt::get(getContext(),
- APInt(BitWidth, 1).shl(SA->getZExtValue()));
+ APInt::getOneBitSet(BitWidth, SA->getZExtValue()));
return getUDivExpr(getSCEV(U->getOperand(0)), getSCEV(X));
}
break;