aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-05-28 18:37:09 +0000
committerBill Wendling <isanbard@gmail.com>2013-05-28 18:37:09 +0000
commit487e8e6b5d92fdb7b5bdd0a71837dc97c5b94201 (patch)
tree1ae735259a58723e5c6ca81fa4c2a1679be6f530
parentce59b5576b717bc4ee8159d740d208d33daa9c3d (diff)
downloadllvm-487e8e6b5d92fdb7b5bdd0a71837dc97c5b94201.zip
llvm-487e8e6b5d92fdb7b5bdd0a71837dc97c5b94201.tar.gz
llvm-487e8e6b5d92fdb7b5bdd0a71837dc97c5b94201.tar.bz2
Merging r182656:
------------------------------------------------------------------------ r182656 | d0k | 2013-05-24 11:05:35 -0700 (Fri, 24 May 2013) | 3 lines LoopVectorize: LoopSimplify can't canonicalize loops with an indirectbr in it, don't assert on those cases. Fixes PR16139. ------------------------------------------------------------------------ llvm-svn: 182785
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp5
-rw-r--r--llvm/test/Transforms/LoopVectorize/lcssa-crash.ll11
2 files changed, 15 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 4f6f51c..bc420bd 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -2308,7 +2308,10 @@ bool LoopVectorizationLegality::canVectorizeWithIfConvert() {
}
bool LoopVectorizationLegality::canVectorize() {
- assert(TheLoop->getLoopPreheader() && "No preheader!!");
+ // We must have a loop in canonical form. Loops with indirectbr in them cannot
+ // be canonicalized.
+ if (!TheLoop->getLoopPreheader())
+ return false;
// We can only vectorize innermost loops.
if (TheLoop->getSubLoopsVector().size())
diff --git a/llvm/test/Transforms/LoopVectorize/lcssa-crash.ll b/llvm/test/Transforms/LoopVectorize/lcssa-crash.ll
index 06b3b08..de6be54 100644
--- a/llvm/test/Transforms/LoopVectorize/lcssa-crash.ll
+++ b/llvm/test/Transforms/LoopVectorize/lcssa-crash.ll
@@ -27,3 +27,14 @@ for.end.i.i.i:
unreachable
}
+; PR16139
+define void @test2(i8* %x) {
+entry:
+ indirectbr i8* %x, [ label %L0, label %L1 ]
+
+L0:
+ br label %L0
+
+L1:
+ ret void
+}