[llvm] ca3f423 - [SLP][NFC]Add/use gather and createFreeeze member functions in
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Fri May 5 09:14:50 PDT 2023
Author: Alexey Bataev
Date: 2023-05-05T09:12:54-07:00
New Revision: ca3f4236e40f1e6cfa96b1c3469d8653384d961f
URL: https://github.com/llvm/llvm-project/commit/ca3f4236e40f1e6cfa96b1c3469d8653384d961f
DIFF: https://github.com/llvm/llvm-project/commit/ca3f4236e40f1e6cfa96b1c3469d8653384d961f.diff
LOG: [SLP][NFC]Add/use gather and createFreeeze member functions in
ShuffleInstructionBuilder, 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 99bacd0d334f..a186ce9eddd3 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -2490,7 +2490,7 @@ class BoUpSLP {
/// \returns a vector from a collection of scalars in \p VL. if \p Root is not
/// specified, the starting vector value is poison.
- Value *gather(ArrayRef<Value *> VL, Value *Root = nullptr);
+ Value *gather(ArrayRef<Value *> VL, Value *Root);
/// \returns whether the VectorizableTree is fully vectorizable and will
/// be beneficial even the tree height is tiny.
@@ -9431,6 +9431,10 @@ class BoUpSLP::ShuffleInstructionBuilder final : public BaseShuffleAnalysis {
inversePermutation(Order, NewMask);
add(V1, NewMask);
}
+ Value *gather(ArrayRef<Value *> VL, Value *Root = nullptr) {
+ return R.gather(VL, Root);
+ }
+ Value *createFreeze(Value *V) { return Builder.CreateFreeze(V); }
/// Finalize emission of the shuffles.
/// \param Action the action (if any) to be performed before final applying of
/// the \p ExtMask mask.
@@ -9905,7 +9909,7 @@ Value *BoUpSLP::createBuildVector(const TreeEntry *E) {
if (!all_of(GatheredScalars, PoisonValue::classof)) {
SmallVector<int> BVMask(GatheredScalars.size(), PoisonMaskElem);
TryPackScalars(GatheredScalars, BVMask, /*IsRootPoison=*/true);
- Value *BV = gather(GatheredScalars);
+ Value *BV = ShuffleBuilder.gather(GatheredScalars);
ShuffleBuilder.add(BV, BVMask);
}
if (all_of(NonConstants, [=](Value *V) {
@@ -9919,13 +9923,13 @@ Value *BoUpSLP::createBuildVector(const TreeEntry *E) {
E->ReuseShuffleIndices, E->Scalars.size(),
[&](Value *&Vec, SmallVectorImpl<int> &Mask) {
TryPackScalars(NonConstants, Mask, /*IsRootPoison=*/false);
- Vec = gather(NonConstants, Vec);
+ Vec = ShuffleBuilder.gather(NonConstants, Vec);
});
} else if (!allConstant(GatheredScalars)) {
// Gather unique scalars and all constants.
SmallVector<int> ReuseMask(GatheredScalars.size(), PoisonMaskElem);
TryPackScalars(GatheredScalars, ReuseMask, /*IsRootPoison=*/true);
- Vec = gather(GatheredScalars);
+ Vec = ShuffleBuilder.gather(GatheredScalars);
ShuffleBuilder.add(Vec, ReuseMask);
Vec = ShuffleBuilder.finalize(E->ReuseShuffleIndices);
} else {
@@ -9935,13 +9939,13 @@ Value *BoUpSLP::createBuildVector(const TreeEntry *E) {
if (!isa<PoisonValue>(V))
Mask[I] = I;
}
- Vec = gather(E->Scalars);
+ Vec = ShuffleBuilder.gather(E->Scalars);
ShuffleBuilder.add(Vec, Mask);
Vec = ShuffleBuilder.finalize(E->ReuseShuffleIndices);
}
if (NeedFreeze)
- Vec = Builder.CreateFreeze(Vec);
+ Vec = ShuffleBuilder.createFreeze(Vec);
return Vec;
}
More information about the llvm-commits
mailing list