[llvm] [SLP] Simplify buildTree() and callees (NFC) (PR #135766)

Gaƫtan Bossu via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 15 03:57:04 PDT 2025


================
@@ -9967,6 +9967,12 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VLRef, unsigned Depth,
   SmallVector<int> ReuseShuffleIndices;
   SmallVector<Value *> VL(VLRef.begin(), VLRef.end());
 
+  auto CreateGatherTreeEntry = [&](const InstructionsState &S) {
+    auto Invalid = ScheduleBundle::invalid();
+    newTreeEntry(VL, Invalid /*not vectorized*/, S, UserTreeIdx,
+                 ReuseShuffleIndices);
+  };
----------------
gbossu wrote:

Now that I think about it, I'd rather get rid of this commit, or create a new method in `BoUpSLP` to replace the lambda and not implicitly capture `VL` and `ReuseShuffleIndices`:

```
  void BoUpSLP::newGatherTreeEntry(ArrayRef<Value *> VL, const InstructionsState &S,
                                   const EdgeInfo &UserTreeIdx,
                                   ArrayRef<int> ReuseShuffleIndices) {
    auto Invalid = ScheduleBundle::invalid();
    newTreeEntry(VL, Invalid, S, UserTreeIdx, ReuseShuffleIndices);
  }
```

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


More information about the llvm-commits mailing list