[llvm] [SelectionDAG] fold interleave of contiguous splats (PR #224318)

Kamlesh Kumar via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 18 09:04:48 PDT 2026


================
@@ -27842,6 +27842,36 @@ SDValue DAGCombiner::visitVECTOR_INTERLEAVE(SDNode *N) {
     }
   }
 
+  // Fold interleave(splat(S[J]), ..., splat(S[J + Factor - 1])) to shuffles
+  // of S.
+  if (VT.isFixedLengthVector() && Op0.getOpcode() == ISD::VECTOR_SHUFFLE) {
+    unsigned Factor = N->getNumOperands();
+    // Non-power-of-two interleaves may be better lowered as structured stores.
+    if (isPowerOf2_32(Factor)) {
----------------
kamleshbhalui wrote:

Yes currently it(4 way interleave) is what i have seen in the benchmark, I think for this case suggested change will do the job , with this assumption mask and result creation also will be simple.

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


More information about the llvm-commits mailing list