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

Fixes PR16139.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182656 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2013-05-24 18:05:35 +00:00
parent fe808927ac
commit 959ecb2eec
2 changed files with 15 additions and 1 deletions

View File

@ -2428,7 +2428,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())

View File

@ -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
}