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

If the preheader of the loop was the entry block of the function, make sure

that the exit block of the loop becomes the new entry block of the function.

This was causing a verifier assertion on 252.eon.

llvm-svn: 13039
This commit is contained in:
Chris Lattner 2004-04-18 17:38:42 +00:00
parent 199b58db3f
commit 430968ac2f

View File

@ -300,10 +300,15 @@ bool LoopUnroll::visitLoop(Loop *L) {
ChangeExitBlocksFromTo(LI->begin(), LI->end(),
Preheader, LoopExit);
// If the preheader was the entry block of this function, move the exit block
// to be the new entry of the loop.
Function *F = LoopExit->getParent();
if (Preheader == &F->front())
F->getBasicBlockList().splice(F->begin(), F->getBasicBlockList(), LoopExit);
// Actually delete the blocks now.
LoopExit->getParent()->getBasicBlockList().erase(Preheader);
LoopExit->getParent()->getBasicBlockList().erase(BB);
F->getBasicBlockList().erase(Preheader);
F->getBasicBlockList().erase(BB);
++NumUnrolled;
return true;