[llvm] [RISCV] Fix incorrect fixed vector lowering for VECTOR_DEINTERLEAVE (PR #207254)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 2 13:46:28 PDT 2026


================
@@ -13163,6 +13148,83 @@ SDValue RISCVTargetLowering::lowerVECTOR_DEINTERLEAVE(SDValue Op,
     return DAG.getMergeValues(Res, DL);
   }
 
+  // Convert to scalable vectors.
+  if (VecVT.isFixedLengthVector()) {
+    ElementCount OrigEC = VecVT.getVectorElementCount();
+    // Note that we cannot just convert individual operands to scalable vectors
+    // and call it a day: as scalable vector container is always equal or
+    // larger than the fixed vector subject, in the case where it is larger
+    // than fixed vector, this approach will create "padded" lanes in the
+    // conceptually concated vector created by VECTOR_DEINTERLEAVE per its
+    // semantics.
+
+    // First, concat operands into a larger (fixed) vector.
+    // There are two ways to do this: insert each operands into a larger
+    // (legal) vector one by one, or concat_vectors with additional
+    // operands to pad to legal type. The first way seems to lead to
+    // worse codegen primarily because we don't run DAGCombiner to
+    // simplify stuffs before some of the insert_subvector got
----------------
topperc wrote:

```suggestion
    // simplify stuff before some of the insert_subvector got
```

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


More information about the llvm-commits mailing list