Pull in r182656 from upstream llvm trunk:

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

  Fixes PR16139.

This should fix clang assertion failures when optimizing at -O3, similar
to:

  Assertion failed: (TheLoop->getLoopPreheader() && "No preheader!!"),
  function canVectorize, file
  contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp, line 2171.

Reported by:	O. Hartmann <ohartman@zedat.fu-berlin.de>
PR:		ports/178332, ports/178977
MFC after:	3 days
This commit is contained in:
dim 2013-05-26 14:14:42 +00:00
parent cfbc0d116c
commit 811490bc91

View File

@ -2169,7 +2169,10 @@ bool LoopVectorizationLegality::canVectorizeWithIfConvert() {
} }
bool LoopVectorizationLegality::canVectorize() { 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. // We can only vectorize innermost loops.
if (TheLoop->getSubLoopsVector().size()) if (TheLoop->getSubLoopsVector().size())