From 1d1faa22d9e5eb3c019696842abc86ab93c7bc46 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Wed, 21 May 2025 16:54:47 +0100 Subject: [PATCH] [X86] combineINSERT_SUBVECTOR - use concatSubVectors instead of direct fold to X86ISD::SUBV_BROADCAST_LOAD Use common helper and try to reduce the number of places we're generating load node directly. --- llvm/lib/Target/X86/X86ISelLowering.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 6be34a3829b32..d6fcfb50f9e8f 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -59360,7 +59360,8 @@ static SDValue combineINSERT_SUBVECTOR(SDNode *N, SelectionDAG &DAG, } // If we're splatting the lower half subvector of a full vector load into the - // upper half, attempt to create a subvector broadcast. + // upper half, just splat the subvector directly, potentially creating a + // subvector broadcast. // TODO: Drop hasOneUse checks. if ((int)IdxVal == (VecNumElts / 2) && Vec.getValueSizeInBits() == (2 * SubVec.getValueSizeInBits()) && @@ -59370,12 +59371,7 @@ static SDValue combineINSERT_SUBVECTOR(SDNode *N, SelectionDAG &DAG, if (VecLd && SubLd && DAG.areNonVolatileConsecutiveLoads( SubLd, VecLd, SubVec.getValueSizeInBits() / 8, 0)) { - SDValue BcastLd = getBROADCAST_LOAD(X86ISD::SUBV_BROADCAST_LOAD, dl, OpVT, - SubVecVT, SubLd, 0, DAG); - SDValue NewSubVec = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, SubVecVT, - BcastLd, DAG.getVectorIdxConstant(0, dl)); - DCI.CombineTo(SubLd, NewSubVec, BcastLd.getValue(1)); - return BcastLd; + return concatSubVectors(SubVec, SubVec, DAG, dl); } }