summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/LoopInfo.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-02-27 22:37:44 +0000
committerChris Lattner <sabre@nondot.org>2003-02-27 22:37:44 +0000
commit72a98545843811f7e59803879237c3017ce8e444 (patch)
tree9c4962bfc4a557885999f518c0210e56a73ae8b3 /llvm/lib/Analysis/LoopInfo.cpp
parente740d2126e616a1f20f64eb3d417a54c31d679ae (diff)
downloadbcm5719-llvm-72a98545843811f7e59803879237c3017ce8e444.tar.gz
bcm5719-llvm-72a98545843811f7e59803879237c3017ce8e444.zip
Change behavior of changeExitBlock function to replace all instances of exit block
llvm-svn: 5661
Diffstat (limited to 'llvm/lib/Analysis/LoopInfo.cpp')
-rw-r--r--llvm/lib/Analysis/LoopInfo.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/LoopInfo.cpp b/llvm/lib/Analysis/LoopInfo.cpp
index 035f92c33c3..a54d659dc8e 100644
--- a/llvm/lib/Analysis/LoopInfo.cpp
+++ b/llvm/lib/Analysis/LoopInfo.cpp
@@ -235,8 +235,8 @@ void Loop::addBasicBlockToLoop(BasicBlock *NewBB, LoopInfo &LI) {
}
}
-/// 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 @@ void Loop::changeExitBlock(BasicBlock *Old, BasicBlock *New) {
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);
+ }
}
OpenPOWER on IntegriCloud