summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2017-07-27 15:48:44 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2017-07-27 15:48:44 +0000
commit07b96e8e969627fda4002523506d74e4577efe62 (patch)
tree103cdded020cc95519c5f10b9f7e33186e5b0f7e /llvm
parent64a795c5f5d46db878323a701a71e611c2bd4d9d (diff)
downloadbcm5719-llvm-07b96e8e969627fda4002523506d74e4577efe62.tar.gz
bcm5719-llvm-07b96e8e969627fda4002523506d74e4577efe62.zip
[SLP] Outline code for the check that instruction users are part of
vectorization tree, NFC. llvm-svn: 309284
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 3e6f84ae7e0..9931c78fcbc 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -416,6 +416,9 @@ public:
private:
struct TreeEntry;
+ /// Checks if all users of \p I are the part of the vectorization tree.
+ bool areAllUsersVectorized(Instruction *I) const;
+
/// \returns the cost of the vectorizable entry.
int getEntryCost(TreeEntry *E);
@@ -1702,6 +1705,13 @@ bool BoUpSLP::canReuseExtract(ArrayRef<Value *> VL, Value *OpValue) const {
return true;
}
+bool BoUpSLP::areAllUsersVectorized(Instruction *I) const {
+ return I->hasOneUse() ||
+ std::all_of(I->user_begin(), I->user_end(), [this](User *U) {
+ return ScalarToTreeEntry.count(U) > 0;
+ });
+}
+
int BoUpSLP::getEntryCost(TreeEntry *E) {
ArrayRef<Value*> VL = E->Scalars;
@@ -1742,10 +1752,7 @@ int BoUpSLP::getEntryCost(TreeEntry *E) {
// If all users are going to be vectorized, instruction can be
// considered as dead.
// The same, if have only one user, it will be vectorized for sure.
- if (E->hasOneUse() ||
- std::all_of(E->user_begin(), E->user_end(), [this](User *U) {
- return ScalarToTreeEntry.count(U) > 0;
- }))
+ if (areAllUsersVectorized(E))
// Take credit for instruction that will become dead.
DeadCost +=
TTI->getVectorInstrCost(Instruction::ExtractElement, VecTy, i);
OpenPOWER on IntegriCloud