[llvm] [DAG] Fold extract_subvector(insert_subvector(x, y, c1), c2) --> extract_subvector(y,c2-c1) (PR #87925)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 8 02:20:49 PDT 2024


================
@@ -24459,6 +24459,23 @@ SDValue DAGCombiner::visitEXTRACT_SUBVECTOR(SDNode *N) {
       if (!LegalOperations || TLI.isOperationLegal(ISD::SPLAT_VECTOR, NVT))
         return DAG.getSplatVector(NVT, SDLoc(N), V.getOperand(0));
 
+  // extract_subvector(insert_subvector(x,y,c1),c2)
+  //  --> extract_subvector(y,c2-c1)
----------------
RKSimon wrote:

Aren't you confusing the AVX subvector instructions (which use subvector offset indices) with the DAG subvector nodes (which use element offset indices)? See getInsertVINSERTImmediate

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


More information about the llvm-commits mailing list