PR21302. Vectorize only bottom-tested loops.

rdar://problem/18886083

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223171 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Michael Zolotukhin
2014-12-02 22:59:06 +00:00
parent 6845cace0e
commit 97be10d98f
2 changed files with 40 additions and 0 deletions

View File

@ -3537,6 +3537,15 @@ bool LoopVectorizationLegality::canVectorize() {
return false;
}
// We only handle bottom-tested loops, i.e. loop in which the condition is
// checked at the end of each iteration. With that we can assume that all
// instructions in the loop are executed the same number of times.
if (TheLoop->getExitingBlock() != TheLoop->getLoopLatch()) {
emitAnalysis(
Report() << "loop control flow is not understood by vectorizer");
return false;
}
// We need to have a loop header.
DEBUG(dbgs() << "LV: Found a loop: " <<
TheLoop->getHeader()->getName() << '\n');