diff options
author | Alexey Bataev <a.bataev@outlook.com> | 2023-11-16 16:26:43 -0800 |
---|---|---|
committer | Alexey Bataev <a.bataev@outlook.com> | 2023-11-16 16:30:52 -0800 |
commit | cb678708e620c21aaf4bb75823b18943937902d7 (patch) | |
tree | 885f44a698e6eafdf8a53f8c0cd06d72b853b9a0 | |
parent | c5a67e16b6117d0c37d004dd5467b56be006ad8f (diff) | |
download | llvm-cb678708e620c21aaf4bb75823b18943937902d7.zip llvm-cb678708e620c21aaf4bb75823b18943937902d7.tar.gz llvm-cb678708e620c21aaf4bb75823b18943937902d7.tar.bz2 |
[SLP][NFC]Add TreeEntry-based add member functions and use them, where
possible, NFC.
-rw-r--r-- | llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index 3af683d..d7967175 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -10276,6 +10276,16 @@ public: VecTy, PoisonValue::get(PointerType::getUnqual(VecTy->getContext())), MaybeAlign()); } + /// Adds 2 input vectors (in form of tree entries) and the mask for their + /// shuffling. + void add(const TreeEntry &E1, const TreeEntry &E2, ArrayRef<int> Mask) { + add(E1.VectorizedValue, E2.VectorizedValue, Mask); + } + /// Adds single input vector (in form of tree entry) and the mask for its + /// shuffling. + void add(const TreeEntry &E1, ArrayRef<int> Mask) { + add(E1.VectorizedValue, Mask); + } /// Adds 2 input vectors and the mask for their shuffling. void add(Value *V1, Value *V2, ArrayRef<int> Mask) { assert(V1 && V2 && !Mask.empty() && "Expected non-empty input vectors."); @@ -10690,7 +10700,7 @@ ResTy BoUpSLP::processBuildVector(const TreeEntry *E, Args &...Params) { Mask[I] = FrontTE->findLaneForValue(V); } } - ShuffleBuilder.add(FrontTE->VectorizedValue, Mask); + ShuffleBuilder.add(*FrontTE, Mask); Res = ShuffleBuilder.finalize(E->getCommonMask()); return Res; } @@ -10868,17 +10878,14 @@ ResTy BoUpSLP::processBuildVector(const TreeEntry *E, Args &...Params) { VecMask.assign(VecMask.size(), PoisonMaskElem); copy(SubMask, std::next(VecMask.begin(), I * SliceSize)); if (TEs.size() == 1) { - IsUsedInExpr &= FindReusedSplat( - VecMask, - cast<FixedVectorType>(TEs.front()->VectorizedValue->getType()) - ->getNumElements()); - ShuffleBuilder.add(TEs.front()->VectorizedValue, VecMask); + IsUsedInExpr &= + FindReusedSplat(VecMask, TEs.front()->getVectorFactor()); + ShuffleBuilder.add(*TEs.front(), VecMask); IsNonPoisoned &= isGuaranteedNotToBePoison(TEs.front()->VectorizedValue); } else { IsUsedInExpr = false; - ShuffleBuilder.add(TEs.front()->VectorizedValue, - TEs.back()->VectorizedValue, VecMask); + ShuffleBuilder.add(*TEs.front(), *TEs.back(), VecMask); IsNonPoisoned &= isGuaranteedNotToBePoison(TEs.front()->VectorizedValue) && isGuaranteedNotToBePoison(TEs.back()->VectorizedValue); |