diff options
author | Arnold Schwaighofer <aschwaighofer@apple.com> | 2013-09-16 16:17:24 +0000 |
---|---|---|
committer | Arnold Schwaighofer <aschwaighofer@apple.com> | 2013-09-16 16:17:24 +0000 |
commit | 5721d2f674008cd2cfa5696441e46daa035408b3 (patch) | |
tree | c5ed59dc8c0ca313b7ba63e01413473e484b96fe /lib/Transforms/Vectorize | |
parent | e5c8c5a1bcecff7e2aa60672be6af2062ad63e6a (diff) | |
download | external_llvm-5721d2f674008cd2cfa5696441e46daa035408b3.zip external_llvm-5721d2f674008cd2cfa5696441e46daa035408b3.tar.gz external_llvm-5721d2f674008cd2cfa5696441e46daa035408b3.tar.bz2 |
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')
-rw-r--r-- | lib/Transforms/Vectorize/LoopVectorize.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp index 9e7335a..1d82c7b 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; } |