[llvm-commits] CVS: llvm/lib/Transforms/Utils/LoopSimplify.cpp

David Greene greened at obbligato.org
Thu Jun 28 19:53:39 PDT 2007



Changes in directory llvm/lib/Transforms/Utils:

LoopSimplify.cpp updated: 1.105 -> 1.106
---
Log message:

Fix reference to iterator invalidated by an erase operation.  Uncovered
by _GLIBCXX_DEBUG.


---
Diffs of the changes:  (+4 -3)

 LoopSimplify.cpp |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)


Index: llvm/lib/Transforms/Utils/LoopSimplify.cpp
diff -u llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.105 llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.106
--- llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.105	Thu Jun 21 12:23:45 2007
+++ llvm/lib/Transforms/Utils/LoopSimplify.cpp	Thu Jun 28 21:53:16 2007
@@ -564,11 +564,12 @@
 
   // Scan all of the loop children of L, moving them to OuterLoop if they are
   // not part of the inner loop.
-  for (Loop::iterator I = L->begin(); I != L->end(); )
-    if (BlocksInL.count((*I)->getHeader()))
+  const std::vector<Loop*> &SubLoops = L->getSubLoops();
+  for (size_t I = 0; I != SubLoops.size(); )
+    if (BlocksInL.count(SubLoops[I]->getHeader()))
       ++I;   // Loop remains in L
     else
-      NewOuter->addChildLoop(L->removeChildLoop(I));
+      NewOuter->addChildLoop(L->removeChildLoop(SubLoops.begin() + I));
 
   // Now that we know which blocks are in L and which need to be moved to
   // OuterLoop, move any blocks that need it.






More information about the llvm-commits mailing list