[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)))
----------------
alexey-bataev wrote:

```suggestion
        if (!TE->isGather() || !E->isSame(TE->Scalars))
```

https://github.com/llvm/llvm-project/pull/213104


More information about the llvm-commits mailing list