summaryrefslogtreecommitdiff
path: root/lib/Transforms/Vectorize/LoopVectorize.cpp
diff options
context:
space:
mode:
authorArnold Schwaighofer <aschwaighofer@apple.com>2013-09-16 16:17:24 +0000
committerArnold Schwaighofer <aschwaighofer@apple.com>2013-09-16 16:17:24 +0000
commit5721d2f674008cd2cfa5696441e46daa035408b3 (patch)
treec5ed59dc8c0ca313b7ba63e01413473e484b96fe /lib/Transforms/Vectorize/LoopVectorize.cpp
parente5c8c5a1bcecff7e2aa60672be6af2062ad63e6a (diff)
downloadllvm-5721d2f674008cd2cfa5696441e46daa035408b3.tar.gz
llvm-5721d2f674008cd2cfa5696441e46daa035408b3.tar.bz2
llvm-5721d2f674008cd2cfa5696441e46daa035408b3.tar.xz
Don't vectorize if there are outside loop users of the induction variable.
We would have to compute the pre increment value, either by computing it on every loop iteration or by splitting the edge out of the loop and inserting a computation for it there. For now, just give up vectorizing such loops. Fixes PR17179. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190790 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Vectorize/LoopVectorize.cpp')
-rw-r--r--lib/Transforms/Vectorize/LoopVectorize.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp
index 9e7335af5f..1d82c7b8f5 100644
--- a/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -2866,6 +2866,12 @@ bool LoopVectorizationLegality::canVectorizeInstrs() {
DEBUG(dbgs() << "LV: Found an induction variable.\n");
Inductions[Phi] = InductionInfo(StartValue, IK);
+
+ // Until we explicitly handle the case of an induction variable with
+ // an outside loop user we have to give up vectorizing this loop.
+ if (hasOutsideLoopUser(TheLoop, it, AllowedExit))
+ return false;
+
continue;
}