summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Vectorize
diff options
context:
space:
mode:
authorMichael Zolotukhin <mzolotukhin@apple.com>2014-12-02 22:59:06 +0000
committerMichael Zolotukhin <mzolotukhin@apple.com>2014-12-02 22:59:06 +0000
commitea8327b80f357011a933e8a3f25df7fb556814cd (patch)
treed598cda54ff5cff6aa3925f5587323a0a4aebcec /llvm/lib/Transforms/Vectorize
parent540580ca06b82da4024a6ed634fcdb9b446ad7ad (diff)
downloadbcm5719-llvm-ea8327b80f357011a933e8a3f25df7fb556814cd.tar.gz
bcm5719-llvm-ea8327b80f357011a933e8a3f25df7fb556814cd.zip
PR21302. Vectorize only bottom-tested loops.
rdar://problem/18886083 llvm-svn: 223171
Diffstat (limited to 'llvm/lib/Transforms/Vectorize')
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 35b2ecf99ce..a73c59bd4f1 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -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');
OpenPOWER on IntegriCloud