diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2013-05-24 18:05:35 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2013-05-24 18:05:35 +0000 |
commit | 6ac1e6237748224facd49b14b1c91f3d2ec2f770 (patch) | |
tree | 15ae6a901b6dd68b50a61439ad1e96ff12dba798 /llvm | |
parent | 753d43f974150043f21b6774d94f91e8bcffbbb8 (diff) | |
download | bcm5719-llvm-6ac1e6237748224facd49b14b1c91f3d2ec2f770.tar.gz bcm5719-llvm-6ac1e6237748224facd49b14b1c91f3d2ec2f770.zip |
LoopVectorize: LoopSimplify can't canonicalize loops with an indirectbr in it, don't assert on those cases.
Fixes PR16139.
llvm-svn: 182656
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 5 | ||||
-rw-r--r-- | llvm/test/Transforms/LoopVectorize/lcssa-crash.ll | 11 |
2 files changed, 15 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index f88ebfd015a..f6c4dea04c1 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -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()) diff --git a/llvm/test/Transforms/LoopVectorize/lcssa-crash.ll b/llvm/test/Transforms/LoopVectorize/lcssa-crash.ll index 06b3b08aa0e..de6be548490 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 +} |