[llvm] [X86] combineINSERT_SUBVECTOR - use concatSubVectors instead of direct fold to X86ISD::SUBV_BROADCAST_LOAD (PR #140919)
via llvm-commits
llvm-commits at lists.llvm.org
Wed May 21 08:57:48 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-x86
Author: Simon Pilgrim (RKSimon)
<details>
<summary>Changes</summary>
Use common helper and try to reduce the number of places we're generating load node directly.
---
Full diff: https://github.com/llvm/llvm-project/pull/140919.diff
1 Files Affected:
- (modified) llvm/lib/Target/X86/X86ISelLowering.cpp (+3-7)
``````````diff
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);
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/140919
More information about the llvm-commits
mailing list