Fix the requisite bug that I introduced

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5605 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2003-02-20 00:28:00 +00:00
parent ae5d39e1bb
commit 3a9a56e7b2

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);
}
} }
} }
} }