[LV] Replace some dead code with an assert. When I first ported this
authorChandler Carruth <chandlerc@gmail.com>
Tue, 18 Mar 2014 21:51:46 +0000 (21:51 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Tue, 18 Mar 2014 21:51:46 +0000 (21:51 +0000)
pass from a loop pass to a function pass I did so in the naive,
recursive way. It doesn't actually work, we need a worklist instead.
When I switched to the worklist I didn't delete the naive recursion.
That recursion was also buggy because it was dead and never really
exercised.

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

lib/Transforms/Vectorize/LoopVectorize.cpp

index 435c0054d0d87d3f29915fb93684db4ab45a1618..dd8d5fce8d4e8c5da3d744bd99df0361753b62fb 100644 (file)
@@ -1067,8 +1067,8 @@ struct LoopVectorize : public FunctionPass {
     // We only handle inner loops, so if there are children just recurse.
     if (!L->empty()) {
       bool Changed = false;
-      for (Loop::iterator I = L->begin(), E = L->begin(); I != E; ++I)
-        Changed |= processLoop(*I);
+      for (Loop *InnerL : *L)
+        Changed |= processLoop(InnerL);
       return Changed;
     }