[llvm-commits] CVS: llvm/lib/Analysis/LoopInfo.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Feb 27 16:38:04 PST 2003


Changes in directory llvm/lib/Analysis:

LoopInfo.cpp updated: 1.32 -> 1.33

---
Log message:

Change behavior of changeExitBlock function to replace all instances of exit block


---
Diffs of the changes:

Index: llvm/lib/Analysis/LoopInfo.cpp
diff -u llvm/lib/Analysis/LoopInfo.cpp:1.32 llvm/lib/Analysis/LoopInfo.cpp:1.33
--- llvm/lib/Analysis/LoopInfo.cpp:1.32	Thu Feb 27 15:51:38 2003
+++ llvm/lib/Analysis/LoopInfo.cpp	Thu Feb 27 16:37:44 2003
@@ -235,8 +235,8 @@
   }
 }
 
-/// changeExitBlock - This method is used to update loop information.  One
-/// instance of the specified Old basic block is removed from the exit list
+/// changeExitBlock - This method is used to update loop information.  All
+/// instances of the specified Old basic block are removed from the exit list
 /// and replaced with New.
 ///
 void Loop::changeExitBlock(BasicBlock *Old, BasicBlock *New) {
@@ -246,4 +246,10 @@
     std::find(ExitBlocks.begin(), ExitBlocks.end(), Old);
   assert(I != ExitBlocks.end() && "Old exit block not found!");
   *I = New;
+
+  I = std::find(I+1, ExitBlocks.end(), Old);
+  while (I != ExitBlocks.end()) {
+    *I = New;
+    I = std::find(I+1, ExitBlocks.end(), Old);
+  }
 }





More information about the llvm-commits mailing list