summaryrefslogtreecommitdiff
path: root/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
commitf5bf464b701908d16f7cee0bbf2b8c8df4f3a917 (patch)
tree779548dfee216513ce90ab3ddb941d71402f762e /lib/Transforms/Scalar/LoopRotation.cpp
parent0403b473dd99b5c7db1fa7048288be6cb42e7abd (diff)
downloadllvm-f5bf464b701908d16f7cee0bbf2b8c8df4f3a917.tar.gz
llvm-f5bf464b701908d16f7cee0bbf2b8c8df4f3a917.tar.bz2
llvm-f5bf464b701908d16f7cee0bbf2b8c8df4f3a917.tar.xz
fix PR9523, a crash in looprotate on a non-canonical loop made out of indirectbr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129203 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopRotation.cpp')
-rw-r--r--lib/Transforms/Scalar/LoopRotation.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/LoopRotation.cpp b/lib/Transforms/Scalar/LoopRotation.cpp
index 95e15784df..e7b1a031f8 100644
--- a/lib/Transforms/Scalar/LoopRotation.cpp
+++ b/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.