Simplify a bit by using a new member function

llvm-svn: 5662
This commit is contained in:
Chris Lattner 2003-02-27 22:48:08 +00:00
parent 72a9854584
commit 72f876223f
1 changed files with 3 additions and 6 deletions

View File

@ -242,12 +242,9 @@ void Loop::addBasicBlockToLoop(BasicBlock *NewBB, LoopInfo &LI) {
void Loop::changeExitBlock(BasicBlock *Old, BasicBlock *New) {
assert(Old != New && "Cannot changeExitBlock to the same thing!");
assert(Old && New && "Cannot changeExitBlock to or from a null node!");
std::vector<BasicBlock*>::iterator I =
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);
assert(hasExitBlock(Old) && "Old exit block not found!");
std::vector<BasicBlock*>::iterator
I = std::find(ExitBlocks.begin(), ExitBlocks.end(), Old);
while (I != ExitBlocks.end()) {
*I = New;
I = std::find(I+1, ExitBlocks.end(), Old);