[llvm] r208476 - SCEV: Use range-based for loop and fold variable into assert.

Benjamin Kramer benny.kra at googlemail.com
Sat May 10 10:47:18 PDT 2014


Author: d0k
Date: Sat May 10 12:47:18 2014
New Revision: 208476

URL: http://llvm.org/viewvc/llvm-project?rev=208476&view=rev
Log:
SCEV: Use range-based for loop and fold variable into assert.

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=208476&r1=208475&r2=208476&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Sat May 10 12:47:18 2014
@@ -7214,14 +7214,12 @@ static void findArrayDimensionsRec(Scala
     return;
   }
 
-  const SCEV *Zero = SE.getConstant(GCD->getType(), 0);
-
-  for (unsigned I = 0; I < Terms.size(); ++I) {
+  for (const SCEV *&Term : Terms) {
     // Normalize the terms before the next call to findArrayDimensionsRec.
     const SCEV *Q, *R;
-    SCEVDivision::divide(SE, Terms[I], GCD, &Q, &R);
-    assert(R == Zero && "GCD does not evenly divide one of the terms");
-    Terms[I] = Q;
+    SCEVDivision::divide(SE, Term, GCD, &Q, &R);
+    assert(R->isZero() && "GCD does not evenly divide one of the terms");
+    Term = Q;
   }
 
   // Remove all SCEVConstants.





More information about the llvm-commits mailing list