summaryrefslogtreecommitdiff
path: root/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
commitf2e2925f95a271505f3ba103bac71b3b6d066c57 (patch)
treebddf03e6b7bcecd4da869a2ca7f3bbeb6df77f1a /lib/Analysis/LoopInfo.cpp
parenta5ca8e5c50298cfa8fb79cdee09adaea9d113bac (diff)
downloadllvm-f2e2925f95a271505f3ba103bac71b3b6d066c57.tar.gz
llvm-f2e2925f95a271505f3ba103bac71b3b6d066c57.tar.bz2
llvm-f2e2925f95a271505f3ba103bac71b3b6d066c57.tar.xz
Change behavior of changeExitBlock function to replace all instances of exit block
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5661 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/LoopInfo.cpp')
-rw-r--r--lib/Analysis/LoopInfo.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp
index 035f92c33c..a54d659dc8 100644
--- a/lib/Analysis/LoopInfo.cpp
+++ b/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);
+ }
}