[llvm] fb35bb4 - [SLP][NFC]Build value-to-gather-nodes map during nodes building, NFC.
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 7 13:44:09 PST 2023
Author: Alexey Bataev
Date: 2023-12-07T13:41:19-08:00
New Revision: fb35bb48c628c83248b64cdac2a094b9e46ae695
URL: https://github.com/llvm/llvm-project/commit/fb35bb48c628c83248b64cdac2a094b9e46ae695
DIFF: https://github.com/llvm/llvm-project/commit/fb35bb48c628c83248b64cdac2a094b9e46ae695.diff
LOG: [SLP][NFC]Build value-to-gather-nodes map during nodes building, NFC.
Added:
Modified:
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 19900ca4ed244..5e37e1eab95ca 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -2883,6 +2883,10 @@ class BoUpSLP {
assert(!BundleMember && "Bundle and VL out of sync");
} else {
MustGather.insert(VL.begin(), VL.end());
+ // Build a map for gathered scalars to the nodes where they are used.
+ for (Value *V : VL)
+ if (!isConstant(V))
+ ValueToGatherNodes.try_emplace(V).first->getSecond().insert(Last);
}
if (UserTreeIdx.UserTE)
@@ -8865,16 +8869,6 @@ static T *performExtractsShuffleAction(
}
InstructionCost BoUpSLP::getTreeCost(ArrayRef<Value *> VectorizedVals) {
- // Build a map for gathered scalars to the nodes where they are used.
- ValueToGatherNodes.clear();
- for (const std::unique_ptr<TreeEntry> &EntryPtr : VectorizableTree) {
- if (EntryPtr->State != TreeEntry::NeedToGather)
- continue;
- for (Value *V : EntryPtr->Scalars)
- if (!isConstant(V))
- ValueToGatherNodes.try_emplace(V).first->getSecond().insert(
- EntryPtr.get());
- }
InstructionCost Cost = 0;
LLVM_DEBUG(dbgs() << "SLP: Calculating cost for tree of size "
<< VectorizableTree.size() << ".\n");
More information about the llvm-commits
mailing list