[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 05:57:57 PDT 2025


================
@@ -25465,6 +25498,22 @@ 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 Splat = DAG.getSplatValue(N->getOperand(0));
+  if (!Splat)
+    return SDValue();
+
+  // Simply replace all results with the first operand.
----------------
paulwalker-arm wrote:

Perhaps "interleave splat(X), splat(X).... --> splat(X), splat(X)...."?

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


More information about the llvm-commits mailing list