[llvm] a2e9c68 - [SLP] Extract a helper for buildvector [nfc]
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 7 19:11:51 PST 2022
Author: Philip Reames
Date: 2022-03-07T19:11:40-08:00
New Revision: a2e9c68fcd4425fbce7380746e916966f00a39a0
URL: https://github.com/llvm/llvm-project/commit/a2e9c68fcd4425fbce7380746e916966f00a39a0
DIFF: https://github.com/llvm/llvm-project/commit/a2e9c68fcd4425fbce7380746e916966f00a39a0.diff
LOG: [SLP] Extract a helper for buildvector [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 9e81326bb39c3..0efe62a19b629 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -1965,6 +1965,11 @@ class BoUpSLP {
/// Vectorize a single entry in the tree, starting in \p VL.
Value *vectorizeTree(ArrayRef<Value *> VL);
+ /// Create a new vector from a list of scalar values. Produces a sequence
+ /// which exploits values reused across lanes, and arranges the inserts
+ /// for ease of later optimization.
+ Value *createBuildVector(ArrayRef<Value *> VL);
+
/// \returns the scalarization cost for this type. Scalarization in this
/// context means the creation of vectors from a group of scalars. If \p
/// NeedToShuffle is true, need to add a cost of reshuffling some of the
@@ -6557,7 +6562,7 @@ class ShuffleInstructionBuilder {
} // namespace
Value *BoUpSLP::vectorizeTree(ArrayRef<Value *> VL) {
- unsigned VF = VL.size();
+ const unsigned VF = VL.size();
InstructionsState S = getSameOpcode(VL);
if (S.getOpcode()) {
if (TreeEntry *E = getTreeEntry(S.OpValue))
@@ -6613,7 +6618,13 @@ Value *BoUpSLP::vectorizeTree(ArrayRef<Value *> VL) {
}
}
- // Check that every instruction appears once in this bundle.
+ // Can't vectorize this, so simply build a new vector with each lane
+ // corresponding to the requested value.
+ return createBuildVector(VL);
+}
+Value *BoUpSLP::createBuildVector(ArrayRef<Value *> VL) {
+ unsigned VF = VL.size();
+ // Exploit possible reuse of values across lanes.
SmallVector<int> ReuseShuffleIndicies;
SmallVector<Value *> UniqueValues;
if (VL.size() > 2) {
More information about the llvm-commits
mailing list