summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/LoopRotation.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-04-09 07:25:58 +0000
committerChris Lattner <sabre@nondot.org>2011-04-09 07:25:58 +0000
commit88974f4625efcb5ba3b108014ee9d6ded5ddc25f (patch)
tree9752cffdbae70dbee08cc405bc34df019d7ab564 /llvm/lib/Transforms/Scalar/LoopRotation.cpp
parente4ec5abf1bad9ae48845047b1c7b9266acb8f671 (diff)
downloadbcm5719-llvm-88974f4625efcb5ba3b108014ee9d6ded5ddc25f.tar.gz
bcm5719-llvm-88974f4625efcb5ba3b108014ee9d6ded5ddc25f.zip
fix PR9523, a crash in looprotate on a non-canonical loop made out of indirectbr.
llvm-svn: 129203
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopRotation.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopRotation.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopRotation.cpp b/llvm/lib/Transforms/Scalar/LoopRotation.cpp
index 95e15784df2..e7b1a031f84 100644
--- a/llvm/lib/Transforms/Scalar/LoopRotation.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopRotation.cpp
@@ -184,7 +184,11 @@ bool LoopRotate::rotateLoop(Loop *L) {
// Now, this loop is suitable for rotation.
BasicBlock *OrigPreheader = L->getLoopPreheader();
BasicBlock *OrigLatch = L->getLoopLatch();
- assert(OrigPreheader && OrigLatch && "Loop not in canonical form?");
+
+ // If the loop could not be converted to canonical form, it must have an
+ // indirectbr in it, just give up.
+ if (OrigPreheader == 0 || OrigLatch == 0)
+ return false;
// Anything ScalarEvolution may know about this loop or the PHI nodes
// in its header will soon be invalidated.
OpenPOWER on IntegriCloud