Fix the requisite bug that I introduced

llvm-svn: 5605
This commit is contained in:
Chris Lattner 2003-02-20 00:28:00 +00:00
parent 1dc4c29b6d
commit 1cbe5116ff
1 changed files with 13 additions and 11 deletions

View File

@ -155,17 +155,19 @@ Loop *LoopInfo::ConsiderForLoop(BasicBlock *BB, const DominatorSet &DS) {
// now by moving the loop into the correct subloop. // now by moving the loop into the correct subloop.
// //
Loop *SubLoop = BBMI->second; Loop *SubLoop = BBMI->second;
Loop *OldSubLoopParent = SubLoop->getParentLoop(); if (SubLoop->getHeader() == *I) { // Only do this once for the loop...
if (OldSubLoopParent != L) { Loop *OldSubLoopParent = SubLoop->getParentLoop();
// Remove SubLoop from OldSubLoopParent's list of subloops... if (OldSubLoopParent != L) {
std::vector<Loop*>::iterator I = // Remove SubLoop from OldSubLoopParent's list of subloops...
std::find(OldSubLoopParent->SubLoops.begin(), std::vector<Loop*>::iterator I =
OldSubLoopParent->SubLoops.end(), SubLoop); std::find(OldSubLoopParent->SubLoops.begin(),
assert(I != OldSubLoopParent->SubLoops.end() OldSubLoopParent->SubLoops.end(), SubLoop);
&& "Loop parent doesn't contain loop?"); assert(I != OldSubLoopParent->SubLoops.end()
OldSubLoopParent->SubLoops.erase(I); && "Loop parent doesn't contain loop?");
SubLoop->ParentLoop = L; OldSubLoopParent->SubLoops.erase(I);
L->SubLoops.push_back(SubLoop); SubLoop->ParentLoop = L;
L->SubLoops.push_back(SubLoop);
}
} }
} }
} }