[llvm] [SelectionDAG] Use unaligned store to legalize `EXTRACT_VECTOR_ELT` type (PR #98176)
Phoebe Wang via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 10 06:05:57 PDT 2024
================
@@ -3531,14 +3548,14 @@ SDValue DAGTypeLegalizer::SplitVecOp_EXTRACT_VECTOR_ELT(SDNode *N) {
// Store the vector to the stack.
// 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.
- Align SmallestAlign = DAG.getReducedAlign(VecVT, /*UseABI=*/false);
+ Align SmallestAlign =
+ std::min(DAG.getSubtarget().getFrameLowering()->getStackAlign(),
+ DAG.getReducedAlign(VecVT, /*UseABI=*/false));
SDValue StackPtr =
DAG.CreateStackTemporary(VecVT.getStoreSize(), SmallestAlign);
- auto &MF = DAG.getMachineFunction();
- auto FrameIndex = cast<FrameIndexSDNode>(StackPtr.getNode())->getIndex();
- auto PtrInfo = MachinePointerInfo::getFixedStack(MF, FrameIndex);
- SDValue Store = DAG.getStore(DAG.getEntryNode(), dl, Vec, StackPtr, PtrInfo,
- SmallestAlign);
+ MachineMemOperand *StoreMMO = getStackAlignedMMO(
+ StackPtr, DAG.getMachineFunction(), VecVT.isScalableVector());
+ SDValue Store = DAG.getStore(DAG.getEntryNode(), dl, Vec, StackPtr, StoreMMO);
----------------
phoebewang wrote:
I assumed we only need to change `SmallestAlign`. Why do we still need these change?
https://github.com/llvm/llvm-project/pull/98176
More information about the llvm-commits
mailing list