summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Vectorize
diff options
context:
space:
mode:
authorAnna Thomas <anna@azul.com>2018-09-04 22:12:23 +0000
committerAnna Thomas <anna@azul.com>2018-09-04 22:12:23 +0000
commitdbacea188b31f4deae2704282c166c03a00821da (patch)
treeff6107ad1e79fac0cf60d1b2d115f9911f7ac64c /llvm/lib/Transforms/Vectorize
parent5bbe8cd7ef9786a2cfe545dcb6b626fed7b381ca (diff)
downloadbcm5719-llvm-dbacea188b31f4deae2704282c166c03a00821da.tar.gz
bcm5719-llvm-dbacea188b31f4deae2704282c166c03a00821da.zip
[LV] First order recurrence phis should not be treated as uniform
This is fix for PR38786. First order recurrence phis were incorrectly treated as uniform, which caused them to be vectorized as uniform instructions. Patch by Ayal Zaks and Orivej Desh! Reviewed by: Anna Differential Revision: https://reviews.llvm.org/D51639 llvm-svn: 341416
Diffstat (limited to 'llvm/lib/Transforms/Vectorize')
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 90f1155c673..7c1012f955c 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -4529,6 +4529,11 @@ void LoopVectorizationCostModel::collectLoopUniforms(unsigned VF) {
// isOutOfScope operands cannot be uniform instructions.
if (isOutOfScope(OV))
continue;
+ // First order recurrence Phi's should typically be considered
+ // non-uniform.
+ auto *OP = dyn_cast<PHINode>(OV);
+ if (OP && Legal->isFirstOrderRecurrence(OP))
+ continue;
// If all the users of the operand are uniform, then add the
// operand into the uniform worklist.
auto *OI = cast<Instruction>(OV);
OpenPOWER on IntegriCloud