[llvm] [SelectionDAG] Use unaligned store/load to move AVX registers onto stack for `insertelement` (PR #82130)

Manish Kausik H via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 26 07:51:10 PDT 2024


================
@@ -1469,12 +1469,11 @@ SDValue SelectionDAGLegalize::ExpandInsertToVectorThroughStack(SDValue Op) {
   EVT VecVT = Vec.getValueType();
   EVT PartVT = Part.getValueType();
   SDValue StackPtr = DAG.CreateStackTemporary(VecVT);
-  int FI = cast<FrameIndexSDNode>(StackPtr.getNode())->getIndex();
-  MachinePointerInfo PtrInfo =
-      MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), FI);
+  MachineMemOperand *AlignedMMO = getStackAlignedMMO(
+      StackPtr, DAG.getMachineFunction(), VecVT.isScalableVector());
----------------
Nirhar wrote:

I had assumed that it was `getFixedStack` that did the magic of clamping down instruction alignment, but looks like I was wrong. The clamping is done in `CreateStackTemporary` (in the call to MFI::CreateStackObject) here:
https://github.com/llvm/llvm-project/blob/862d837e483437b33f5588f89e62085de3a806b9/llvm/lib/CodeGen/MachineFrameInfo.cpp#L56

I think I need to move the call to `CreateStackTemporary` inside `getStackAlignedMMO`

https://github.com/llvm/llvm-project/pull/82130


More information about the llvm-commits mailing list