[llvm] [SLP] De-duplicate costing of perfect-diamond gather spills (PR #220569)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 7 06:56:57 PDT 2026


================
@@ -19040,6 +19045,78 @@ InstructionCost BoUpSLP::getSpillCost() {
     }
     return nullptr;
   };
+  auto IsCoveredByMatchingVectorEntry = [&](const TreeEntry *Gather,
+                                            const Loop *SpillLoop) -> bool {
+    assert(Gather->isGather());
+
+    Value *LookupValue = nullptr;
+    if (Gather->hasState()) {
+      LookupValue = Gather->getMainOp();
+    } else {
+      auto *It = find_if(Gather->Scalars, [](Value *V) {
+        return !isa<PoisonValue, UndefValue>(V);
+      });
----------------
alexey-bataev wrote:

```suggestion
      auto *It = find_if_not(Gather->Scalars, IsaPred<UndefValue>(V));
```

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


More information about the llvm-commits mailing list