[llvm] r182656 - LoopVectorize: LoopSimplify can't canonicalize loops with an indirectbr in it, don't assert on those cases.

Benjamin Kramer benny.kra at googlemail.com
Fri May 24 11:05:35 PDT 2013


Author: d0k
Date: Fri May 24 13:05:35 2013
New Revision: 182656

URL: http://llvm.org/viewvc/llvm-project?rev=182656&view=rev
Log:
LoopVectorize: LoopSimplify can't canonicalize loops with an indirectbr in it, don't assert on those cases.

Fixes PR16139.

Modified:
    llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
    llvm/trunk/test/Transforms/LoopVectorize/lcssa-crash.ll

Modified: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=182656&r1=182655&r2=182656&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp Fri May 24 13:05:35 2013
@@ -2428,7 +2428,10 @@ bool LoopVectorizationLegality::canVecto
 }
 
 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())

Modified: llvm/trunk/test/Transforms/LoopVectorize/lcssa-crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopVectorize/lcssa-crash.ll?rev=182656&r1=182655&r2=182656&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/LoopVectorize/lcssa-crash.ll (original)
+++ llvm/trunk/test/Transforms/LoopVectorize/lcssa-crash.ll Fri May 24 13:05:35 2013
@@ -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
+}





More information about the llvm-commits mailing list