diff options
| author | Zhou Sheng <zhousheng00@gmail.com> | 2007-04-07 17:48:27 +0000 |
|---|---|---|
| committer | Zhou Sheng <zhousheng00@gmail.com> | 2007-04-07 17:48:27 +0000 |
| commit | 2852d99a48349dde9a9df91d6307fec5a2ba1e66 (patch) | |
| tree | 3eb0bef1aea12c023a3885df25be557902ee2b2c /llvm/lib/Analysis/ScalarEvolution.cpp | |
| parent | 24334a3561b7472b7dfe0855f0adba9e0362f0e6 (diff) | |
| download | bcm5719-llvm-2852d99a48349dde9a9df91d6307fec5a2ba1e66.tar.gz bcm5719-llvm-2852d99a48349dde9a9df91d6307fec5a2ba1e66.zip | |
Eliminate unnecessary APInt construction.
llvm-svn: 35740
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
| -rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 48b0d6d30e5..bbb59d52c16 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -500,7 +500,7 @@ static SCEVHandle PartialFact(SCEVHandle V, unsigned NumSteps) { // Handle this case efficiently, it is common to have constant iteration // counts while computing loop exit values. if (SCEVConstant *SC = dyn_cast<SCEVConstant>(V)) { - APInt Val = SC->getValue()->getValue(); + const APInt& Val = SC->getValue()->getValue(); APInt Result(Val.getBitWidth(), 1); for (; NumSteps; --NumSteps) Result *= Val-(NumSteps-1); @@ -1336,7 +1336,7 @@ SCEVHandle ScalarEvolutionsImpl::createNodeForPHI(PHINode *PN) { /// example, turn {4,+,8} -> 4. (S umod result) should always equal zero. static APInt GetConstantFactor(SCEVHandle S) { if (SCEVConstant *C = dyn_cast<SCEVConstant>(S)) { - APInt V = C->getValue()->getValue(); + const APInt& V = C->getValue()->getValue(); if (!V.isMinValue()) return V; else // Zero is a multiple of everything. @@ -2096,23 +2096,22 @@ SolveQuadraticEquation(const SCEVAddRecExpr *AddRec) { } uint32_t BitWidth = LC->getValue()->getValue().getBitWidth(); - APInt L(LC->getValue()->getValue()); - APInt M(MC->getValue()->getValue()); - APInt N(MC->getValue()->getValue()); + const APInt& L = LC->getValue()->getValue(); + const APInt& M = MC->getValue()->getValue(); + const APInt& N = MC->getValue()->getValue(); APInt Two(BitWidth, 2); APInt Four(BitWidth, 4); { using namespace APIntOps; - APInt C(L); + const APInt& C = L; // Convert from chrec coefficients to polynomial coefficients AX^2+BX+C // The B coefficient is M-N/2 APInt B(M); B -= sdiv(N,Two); // The A coefficient is N/2 - APInt A(N); - A = A.sdiv(Two); + APInt A(N.sdiv(Two)); // Compute the B^2-4ac term. APInt SqrtTerm(B); |

