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

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 10 07:13:55 PDT 2026


================
@@ -27553,6 +27556,51 @@ static SDValue foldExtractSubvectorFromShuffleVector(EVT NarrowVT, SDValue Src,
   return DAG.getVectorShuffle(NarrowVT, DL, NewOps[0], NewOps[1], NewMask);
 }
 
+SDValue DAGCombiner::foldExtractSubvectorFromConcatVectors(EVT VT, SDValue V,
+                                                           uint64_t ExtIdx,
+                                                           const SDLoc &DL) {
+  assert(V.getOpcode() == ISD::CONCAT_VECTORS &&
+         "Expected a CONCAT_VECTORS operand");
+  ElementCount ExtNumElts = VT.getVectorElementCount();
----------------
paulwalker-arm wrote:

I know `ExtIdx` should be valid, but this is an isolated function so I'd be happier if there was an assert for "ExtIdx % ExtNumElts.getKnownMinValue() == 0", if only to better frame the later transformations.

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


More information about the llvm-commits mailing list