[llvm] [DAGCombiner] Add combine for vector interleave of splats (PR #151110)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 29 07:48:28 PDT 2025
================
@@ -25173,6 +25173,38 @@ static SDValue combineConcatVectorOfCasts(SDNode *N, SelectionDAG &DAG) {
return DAG.getNode(CastOpcode, DL, VT, NewConcat);
}
+static SDValue combineConcatVectorInterleave(SDNode *N, SelectionDAG &DAG) {
+ SDValue FirstOp = N->getOperand(0);
+ if (FirstOp.getOpcode() != ISD::VECTOR_INTERLEAVE ||
+ FirstOp.getNumOperands() != N->getNumOperands())
+ return SDValue();
+
+ for (unsigned I = 0; I < N->getNumOperands(); I++) {
+ if (N->getOperand(I).getResNo() != I ||
+ N->getOperand(I).getNode() != FirstOp.getNode())
+ return SDValue();
+ }
+
+ SDValue InOp0 = FirstOp.getOperand(0);
+ if (!llvm::all_of(FirstOp->ops(),
+ [&InOp0](SDValue Op) { return Op == InOp0; }))
+ return SDValue();
----------------
lukel97 wrote:
I presume the lambda's there because we need to cast from SDUse to SDValue? Does `all_equal(FirstOp->op_values())` work?
https://github.com/llvm/llvm-project/pull/151110
More information about the llvm-commits
mailing list