1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

Insert new pre-header before new header. Original pre-header may

happen to be an entry, in such case, it is not a good idea to
insert new block before entry.

Also fix typo in assertion check.

llvm-svn: 35833
This commit is contained in:
Devang Patel 2007-04-09 21:40:43 +00:00
parent b31e6eee0c
commit 5392489e86

View File

@ -429,7 +429,7 @@ void LoopRotate::preserveCanonicalLoopForm(LPPassManager &LPM) {
// exit block. Insert new block between original pre-header and
// new header such that loop's new pre-header has only one successor.
BasicBlock *NewPreHeader = new BasicBlock("bb.nph", OrigHeader->getParent(),
OrigPreHeader);
NewHeader);
LoopInfo &LI = LPM.getAnalysis<LoopInfo>();
if (Loop *PL = LI.getLoopFor(OrigPreHeader))
PL->addBasicBlockToLoop(NewPreHeader, LI);
@ -439,7 +439,7 @@ void LoopRotate::preserveCanonicalLoopForm(LPPassManager &LPM) {
if (OrigPH_BI->getSuccessor(0) == NewHeader)
OrigPH_BI->setSuccessor(0, NewPreHeader);
else {
assert (OrigPH_BI->getSuccessor(1) == NewPreHeader &&
assert (OrigPH_BI->getSuccessor(1) == NewHeader &&
"Unexpected original pre-header terminator");
OrigPH_BI->setSuccessor(1, NewPreHeader);
}