[llvm] r303092 - [SCEV] Use copy initialization of APInts instead of direct initialization.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon May 15 11:14:16 PDT 2017


Author: ctopper
Date: Mon May 15 13:14:16 2017
New Revision: 303092

URL: http://llvm.org/viewvc/llvm-project?rev=303092&view=rev
Log:
[SCEV] Use copy initialization of APInts instead of direct initialization.

This is based on post commit feed back from r302769.

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=303092&r1=303091&r2=303092&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon May 15 13:14:16 2017
@@ -7403,17 +7403,17 @@ SolveQuadraticEquation(const SCEVAddRecE
   // Convert from chrec coefficients to polynomial coefficients AX^2+BX+C
 
   // The A coefficient is N/2
-  APInt A(N.sdiv(Two));
+  APInt A = N.sdiv(Two);
 
   // The B coefficient is M-N/2
-  APInt B(M);
+  APInt B = M;
   B -= A; // A is the same as N/2.
 
   // The C coefficient is L.
   const APInt& C = L;
 
   // Compute the B^2-4ac term.
-  APInt SqrtTerm(B);
+  APInt SqrtTerm = B;
   SqrtTerm *= B;
   SqrtTerm -= 4 * (A * C);
 
@@ -7424,12 +7424,12 @@ SolveQuadraticEquation(const SCEVAddRecE
 
   // Compute sqrt(B^2-4ac). This is guaranteed to be the nearest
   // integer value or else APInt::sqrt() will assert.
-  APInt SqrtVal(SqrtTerm.sqrt());
+  APInt SqrtVal = SqrtTerm.sqrt();
 
   // Compute the two solutions for the quadratic formula.
   // The divisions must be performed as signed divisions.
-  APInt NegB(-std::move(B));
-  APInt TwoA(std::move(A));
+  APInt NegB = -std::move(B);
+  APInt TwoA = std::move(A);
   TwoA <<= 1;
   if (TwoA.isNullValue())
     return None;




More information about the llvm-commits mailing list