[llvm] [SelectionDAG] Use unaligned store to legalize `EXTRACT_VECTOR_ELT` type (PR #98176)
Manish Kausik H via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 26 03:40:45 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);
----------------
Nirhar wrote:
Have implemented (2) and have corrected lit tests to suit it as well. Please check @phoebewang @RKSimon .
https://github.com/llvm/llvm-project/pull/98176
More information about the llvm-commits
mailing list