summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-04-18 17:38:42 +0000
committerChris Lattner <sabre@nondot.org>2004-04-18 17:38:42 +0000
commit30ae18155ddd18c634a71bb462890701abcc98d6 (patch)
tree43a30a6503d928bff74b79c00007080407500894 /llvm/lib
parent230bcb6b353a0d565fcfff3406f1e6f056afa17c (diff)
downloadbcm5719-llvm-30ae18155ddd18c634a71bb462890701abcc98d6.tar.gz
bcm5719-llvm-30ae18155ddd18c634a71bb462890701abcc98d6.zip
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
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopUnroll.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnroll.cpp b/llvm/lib/Transforms/Scalar/LoopUnroll.cpp
index 266afbbe9b3..90de9e946da 100644
--- a/llvm/lib/Transforms/Scalar/LoopUnroll.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopUnroll.cpp
@@ -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;
OpenPOWER on IntegriCloud