[LV] While I'm here, use range based for loops which are so much cleaner
authorChandler Carruth <chandlerc@gmail.com>
Tue, 18 Mar 2014 22:00:32 +0000 (22:00 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Tue, 18 Mar 2014 22:00:32 +0000 (22:00 +0000)
for this kind of walk.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204188 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Vectorize/LoopVectorize.cpp

index 1f02bf6cbe99b79f049a4da5663b935f9bc1320c..dc1ca5c291e0f274b432acac5e131db18b1c364f 100644 (file)
@@ -989,12 +989,12 @@ private:
   }
 };
 
-static void addInnerLoop(Loop *L, SmallVectorImpl<Loop *> &V) {
-  if (L->empty())
-    return V.push_back(L);
+static void addInnerLoop(Loop &L, SmallVectorImpl<Loop *> &V) {
+  if (L.empty())
+    return V.push_back(&L);
 
-  for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I)
-    addInnerLoop(*I, V);
+  for (Loop *InnerL : L)
+    addInnerLoop(*InnerL, V);
 }
 
 /// The LoopVectorize Pass.
@@ -1051,8 +1051,8 @@ struct LoopVectorize : public FunctionPass {
     // and can invalidate iterators across the loops.
     SmallVector<Loop *, 8> Worklist;
 
-    for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I)
-      addInnerLoop(*I, Worklist);
+    for (Loop *L : *LI)
+      addInnerLoop(*L, Worklist);
 
     // Now walk the identified inner loops.
     bool Changed = false;