Skip to content

Commit f1d03de

Browse files
authored
[X86] combineINSERT_SUBVECTOR - use concatSubVectors instead of direct fold to X86ISD::SUBV_BROADCAST_LOAD (#140919)
Use common helper and try to reduce the number of places we're generating load node directly.
1 parent e424787 commit f1d03de

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59360,7 +59360,8 @@ static SDValue combineINSERT_SUBVECTOR(SDNode *N, SelectionDAG &DAG,
5936059360
}
5936159361

5936259362
// If we're splatting the lower half subvector of a full vector load into the
59363-
// upper half, attempt to create a subvector broadcast.
59363+
// upper half, just splat the subvector directly, potentially creating a
59364+
// subvector broadcast.
5936459365
// TODO: Drop hasOneUse checks.
5936559366
if ((int)IdxVal == (VecNumElts / 2) &&
5936659367
Vec.getValueSizeInBits() == (2 * SubVec.getValueSizeInBits()) &&
@@ -59370,12 +59371,7 @@ static SDValue combineINSERT_SUBVECTOR(SDNode *N, SelectionDAG &DAG,
5937059371
if (VecLd && SubLd &&
5937159372
DAG.areNonVolatileConsecutiveLoads(
5937259373
SubLd, VecLd, SubVec.getValueSizeInBits() / 8, 0)) {
59373-
SDValue BcastLd = getBROADCAST_LOAD(X86ISD::SUBV_BROADCAST_LOAD, dl, OpVT,
59374-
SubVecVT, SubLd, 0, DAG);
59375-
SDValue NewSubVec = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, SubVecVT,
59376-
BcastLd, DAG.getVectorIdxConstant(0, dl));
59377-
DCI.CombineTo(SubLd, NewSubVec, BcastLd.getValue(1));
59378-
return BcastLd;
59374+
return concatSubVectors(SubVec, SubVec, DAG, dl);
5937959375
}
5938059376
}
5938159377

0 commit comments

Comments
 (0)