diff options
author | Arnold Schwaighofer <aschwaighofer@apple.com> | 2013-10-07 21:05:43 +0000 |
---|---|---|
committer | Arnold Schwaighofer <aschwaighofer@apple.com> | 2013-10-07 21:05:43 +0000 |
commit | 0caddfc73103d4be8c1f98fc66d6313929152148 (patch) | |
tree | fc86b700d772ccc9199c7a759c076babe10dd7cc /llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | |
parent | 52fbac7d90f49740de0916a04bbaf189d721f74c (diff) | |
download | bcm5719-llvm-0caddfc73103d4be8c1f98fc66d6313929152148.tar.gz bcm5719-llvm-0caddfc73103d4be8c1f98fc66d6313929152148.zip |
LoopVectorize: External uses must use the last value in a reduction cycle
Otherwise, we don't perform operations that would have been performed on
the scalar version.
Fixes PR17498.
llvm-svn: 192133
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/LoopVectorize.cpp')
-rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index a71df08aba0..415f86e8938 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -4015,6 +4015,12 @@ bool LoopVectorizationLegality::AddReductionVar(PHINode *Phi, if (ExitInstruction != 0 || Cur == Phi) return false; + // The instruction used by an outside user must be the last instruction + // before we feed back to the reduction phi. Otherwise, we loose VF-1 + // operations on the value. + if (std::find(Phi->op_begin(), Phi->op_end(), Cur) == Phi->op_end()) + return false; + ExitInstruction = Cur; continue; } |