From ea8327b80f357011a933e8a3f25df7fb556814cd Mon Sep 17 00:00:00 2001 From: Michael Zolotukhin Date: Tue, 2 Dec 2014 22:59:06 +0000 Subject: PR21302. Vectorize only bottom-tested loops. rdar://problem/18886083 llvm-svn: 223171 --- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'llvm/lib/Transforms/Vectorize') 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'); -- cgit v1.2.3