summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Vectorize/VPlanValue.h
diff options
context:
space:
mode:
authorFlorian Hahn <florian.hahn@arm.com>2018-11-14 13:11:49 +0000
committerFlorian Hahn <florian.hahn@arm.com>2018-11-14 13:11:49 +0000
commit09e516c54b0c5ec3fe6b3ef6c70d9e09e89abc95 (patch)
treeffd47e67d0b056770599f2e06527d2439c996baf /llvm/lib/Transforms/Vectorize/VPlanValue.h
parent3f82b15bdca3d471f844f5862892fabc9687807a (diff)
downloadbcm5719-llvm-09e516c54b0c5ec3fe6b3ef6c70d9e09e89abc95.tar.gz
bcm5719-llvm-09e516c54b0c5ec3fe6b3ef6c70d9e09e89abc95.zip
[VPlan, SLP] Add simple SLP analysis on top of VPlan.
This patch adds an initial implementation of the look-ahead SLP tree construction described in 'Look-Ahead SLP: Auto-vectorization in the Presence of Commutative Operations, CGO 2018 by Vasileios Porpodas, Rodrigo C. O. Rocha, Luís F. W. Góes'. It returns an SLP tree represented as VPInstructions, with combined instructions represented as a single, wider VPInstruction. This initial version does not support instructions with multiple different users (either inside or outside the SLP tree) or non-instruction operands; it won't generate any shuffles or insertelement instructions. It also just adds the analysis that builds an SLP tree rooted in a set of stores. It does not include any cost modeling or memory legality checks. The plan is to integrate it with VPlan based cost modeling, once available and to only apply it to operations that can be widened. A follow-up patch will add a support for replacing instructions in a VPlan with their SLP counter parts. Reviewers: Ayal, mssimpso, rengolin, mkuper, hfinkel, hsaito, dcaballe, vporpo, RKSimon, ABataev Reviewed By: rengolin Differential Revision: https://reviews.llvm.org/D4949 llvm-svn: 346857
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/VPlanValue.h')
-rw-r--r--llvm/lib/Transforms/Vectorize/VPlanValue.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Vectorize/VPlanValue.h b/llvm/lib/Transforms/Vectorize/VPlanValue.h
index 972f0fa7da6..b473579b699 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanValue.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanValue.h
@@ -106,6 +106,20 @@ public:
const_user_range users() const {
return const_user_range(user_begin(), user_end());
}
+
+ /// Returns true if the value has more than one unique user.
+ bool hasMoreThanOneUniqueUser() {
+ if (getNumUsers() == 0)
+ return false;
+
+ // Check if all users match the first user.
+ auto Current = std::next(user_begin());
+ while (Current != user_end() && *user_begin() == *Current)
+ Current++;
+ return Current != user_end();
+ }
+
+ void replaceAllUsesWith(VPValue *New);
};
typedef DenseMap<Value *, VPValue *> Value2VPValueTy;
@@ -151,6 +165,8 @@ public:
return Operands[N];
}
+ void setOperand(unsigned I, VPValue *New) { Operands[I] = New; }
+
typedef SmallVectorImpl<VPValue *>::iterator operand_iterator;
typedef SmallVectorImpl<VPValue *>::const_iterator const_operand_iterator;
typedef iterator_range<operand_iterator> operand_range;
OpenPOWER on IntegriCloud