[llvm] [DAGCombiner] Spill dynamic insertelt chain in one go (PR #162368)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 7 13:26:21 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 3071aac3a..be8daa51f 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -23455,7 +23455,7 @@ SDValue DAGCombiner::visitINSERT_VECTOR_ELT(SDNode *N) {
SDValue InVec = Seq.back()->getOperand(0);
SDValue EltNo = InVec.getOperand(2);
if (!(InVec.getOpcode() == ISD::INSERT_VECTOR_ELT &&
- !isa<ConstantSDNode>(EltNo)))
+ !isa<ConstantSDNode>(EltNo)))
break;
Seq.push_back(InVec.getNode());
}
@@ -23464,35 +23464,38 @@ SDValue DAGCombiner::visitINSERT_VECTOR_ELT(SDNode *N) {
// the type legalizer just fine.
if (Seq.size() > 1) {
// In cases where the vector is illegal it will be broken down into parts
- // and stored in parts - we should use the alignment for the smallest part.
+ // and stored in parts - we should use the alignment for the smallest
+ // part.
Align SmallestAlign = DAG.getReducedAlign(VT, /*UseABI=*/false);
- SDValue StackPtr = DAG.CreateStackTemporary(VT.getStoreSize(), SmallestAlign);
+ SDValue StackPtr =
+ DAG.CreateStackTemporary(VT.getStoreSize(), SmallestAlign);
auto &MF = DAG.getMachineFunction();
auto FrameIndex = cast<FrameIndexSDNode>(StackPtr.getNode())->getIndex();
auto PtrInfo = MachinePointerInfo::getFixedStack(MF, FrameIndex);
// Begin spilling
SDValue InVec = Seq.back()->getOperand(0);
- SDValue Store = DAG.getStore(DAG.getEntryNode(), DL, InVec, StackPtr, PtrInfo,
- SmallestAlign);
+ SDValue Store = DAG.getStore(DAG.getEntryNode(), DL, InVec, StackPtr,
+ PtrInfo, SmallestAlign);
// Lower each dynamic insertelt to a store
for (SDNode *N : reverse(Seq)) {
SDValue Elmnt = N->getOperand(1);
SDValue Index = N->getOperand(2);
- // Store the new element. This may be larger than the vector element type,
- // so use a truncating store.
+ // Store the new element. This may be larger than the vector element
+ // type, so use a truncating store.
SDValue EltPtr = TLI.getVectorElementPointer(DAG, StackPtr, VT, Index);
EVT EltVT = Elmnt.getValueType();
Store = DAG.getTruncStore(
Store, DL, Elmnt, EltPtr, MachinePointerInfo::getUnknownStack(MF),
- EltVT, commonAlignment(SmallestAlign,
- EltVT.getFixedSizeInBits() / 8));
+ EltVT,
+ commonAlignment(SmallestAlign, EltVT.getFixedSizeInBits() / 8));
}
// Load the spilled vector
- SDValue Load = DAG.getLoad(VT, DL, Store, StackPtr, PtrInfo, SmallestAlign);
+ SDValue Load =
+ DAG.getLoad(VT, DL, Store, StackPtr, PtrInfo, SmallestAlign);
return Load.getValue(0);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/162368
More information about the llvm-commits
mailing list