[llvm] [DAGCombiner] Add combine for vector interleave of splats (PR #151110)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 31 03:53:39 PDT 2025


================
@@ -331,6 +331,11 @@ namespace {
       return CombineTo(N, To, 2, AddTo);
     }
 
+    SDValue CombineTo(SDNode *N, SmallVectorImpl<SDValue> *To,
----------------
david-arm wrote:

This fails to build with error:

```
DAGCombiner.cpp:25519:27: error: no matching function for call to ‘{anonymous}::DAGCombiner::CombineTo(llvm::SDNode*&, llvm::SmallVector<llvm::SDValue, 4>*)’
25519 |   return CombineTo(N, &Ops);
```

The existing interface for CombineTo isn't great:

```
    SDValue CombineTo(SDNode *N, const SDValue *To, unsigned NumTo,
                      bool AddTo = true);
```

because there is no easy way to get access to a C-like array of SDValue operands from a SDNode, which is why I went down the `SmallVector` route although it also feels a bit awkward.

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


More information about the llvm-commits mailing list