[llvm] r302333 - [SCEV] Use APInt's uint64_t operations instead of creating a temporary APInt to hold 1.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri May 5 22:15:12 PDT 2017


Author: ctopper
Date: Sat May  6 00:15:11 2017
New Revision: 302333

URL: http://llvm.org/viewvc/llvm-project?rev=302333&view=rev
Log:
[SCEV] Use APInt's uint64_t operations instead of creating a temporary APInt to hold 1.

Modified:
    llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=302333&r1=302332&r2=302333&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Sat May  6 00:15:11 2017
@@ -9306,9 +9306,8 @@ const SCEV *SCEVAddRecExpr::getNumIterat
     // the upper value of the range must be the first possible exit value.
     // If A is negative then the lower of the range is the last possible loop
     // value.  Also note that we already checked for a full range.
-    APInt One(BitWidth,1);
     APInt A = cast<SCEVConstant>(getOperand(1))->getAPInt();
-    APInt End = A.sge(One) ? (Range.getUpper() - One) : Range.getLower();
+    APInt End = A.sge(1) ? (Range.getUpper() - 1) : Range.getLower();
 
     // The exit value should be (End+A)/A.
     APInt ExitVal = (End + A).udiv(A);
@@ -9324,7 +9323,7 @@ const SCEV *SCEVAddRecExpr::getNumIterat
     // Ensure that the previous value is in the range.  This is a sanity check.
     assert(Range.contains(
            EvaluateConstantChrecAtConstant(this,
-           ConstantInt::get(SE.getContext(), ExitVal - One), SE)->getValue()) &&
+           ConstantInt::get(SE.getContext(), ExitVal - 1), SE)->getValue()) &&
            "Linear scev computation is off in a bad way!");
     return SE.getConstant(ExitValue);
   } else if (isQuadratic()) {




More information about the llvm-commits mailing list