[llvm-branch-commits] [llvm] [SelectionDAG] Fold extracts spanning concat operands (PR #200936)

Krzysztof Drewniak via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jun 3 11:52:13 PDT 2026


================
@@ -27493,6 +27493,65 @@ static SDValue foldExtractSubvectorFromShuffleVector(EVT NarrowVT, SDValue Src,
   return DAG.getVectorShuffle(NarrowVT, DL, NewOps[0], NewOps[1], NewMask);
 }
 
+static SDValue foldExtractSubvectorFromConcatVectors(EVT VT, SDValue V,
+                                                     uint64_t ExtIdx,
+                                                     const SDLoc &DL,
+                                                     SelectionDAG &DAG,
+                                                     bool LegalOperations) {
+  if (V.getOpcode() != ISD::CONCAT_VECTORS)
+    return SDValue();
+
+  unsigned ExtNumElts = VT.getVectorMinNumElements();
+  EVT ConcatSrcVT = V.getOperand(0).getValueType();
+  assert(ConcatSrcVT.getVectorElementType() == VT.getVectorElementType() &&
+         "Concat and extract subvector do not change element type");
----------------
krzysz00 wrote:

Now that I think about it some more, there isn't any way for this assert to trip on legal test input - neither extract_subvector or concat_vectors allow warping the element type, so I can probably ditch it

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


More information about the llvm-branch-commits mailing list