[llvm] [SLP] More accurately cost RISCV scalar splats (PR #213104)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 12 05:42:00 PDT 2026
================
@@ -22858,10 +22684,30 @@ ResTy BoUpSLP::processBuildVector(const TreeEntry *E, Type *ScalarTy,
// Gather unique scalars and all constants.
SmallVector<int> ReuseMask(GatheredScalars.size(), PoisonMaskElem);
TryPackScalars(GatheredScalars, ReuseMask, /*IsRootPoison=*/true);
- Value *BV = ShuffleBuilder.gather(GatheredScalars, ReuseMask.size());
- ShuffleBuilder.add(BV, ReuseMask);
+ auto GatherUserOps = [&](SmallVectorImpl<TTI::BuildVectorUseOp> &UserOps) {
+ bool HasMatches = false;
+ for (const auto &TE : VectorizableTree) {
+ if (DeletedNodes.contains(TE.get()))
+ continue;
+ if (!(TE->isGather() && E->isSame(TE->Scalars)))
+ continue;
+ HasMatches = true;
+ auto *UserTE = TE->UserTreeIndex.UserTE;
+ if (!UserTE || !UserTE->hasState() || UserTE->isAltShuffle())
+ return false;
+ UserOps.push_back(
+ {UserTE->getOpcode(), static_cast<int>(TE->UserTreeIndex.EdgeIdx)});
----------------
alexey-bataev wrote:
```suggestion
UserOps.emplace_back(
UserTE->getOpcode(), TE->UserTreeIndex.EdgeIdx);
```
https://github.com/llvm/llvm-project/pull/213104
More information about the llvm-commits
mailing list