SCEV: Use range-based for loop and fold variable into assert.
authorBenjamin Kramer <benny.kra@googlemail.com>
Sat, 10 May 2014 17:47:18 +0000 (17:47 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sat, 10 May 2014 17:47:18 +0000 (17:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208476 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ScalarEvolution.cpp

index f065d851a0089d1ea4a15490fa4ec6df0cfee205..5f06e8238c9aa0b71f4d329ae3f4d96ac1242593 100644 (file)
@@ -7214,14 +7214,12 @@ static void findArrayDimensionsRec(ScalarEvolution &SE,
     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.