[llvm] [DAGCombiner] Add combine for vector interleave of splats (PR #151110)
Paul Walker via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 31 03:52:21 PDT 2025
================
@@ -25465,6 +25502,24 @@ SDValue DAGCombiner::visitCONCAT_VECTORS(SDNode *N) {
return SDValue();
}
+SDValue DAGCombiner::visitVECTOR_INTERLEAVE(SDNode *N) {
+ // Check to see if all operands are identical.
+ if (!llvm::all_equal(N->op_values()))
+ return SDValue();
+
+ // Check to see if the identical operand is a splat.
+ SDValue Op0 = N->getOperand(0);
+ SDValue Splat = DAG.getSplatValue(Op0);
+ if (!Splat)
+ return SDValue();
+
+ // Simply replace all results with the first operand.
+ SmallVector<SDValue, 4> Ops;
+ Ops.append(N->op_values().begin(), N->op_values().end());
+ SDValue Res = CombineTo(N, &Ops);
+ return Res;
----------------
paulwalker-arm wrote:
```suggestion
return CombineTo(N, &Ops);
```
https://github.com/llvm/llvm-project/pull/151110
More information about the llvm-commits
mailing list