[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
Mon Jul 29 09:05:25 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:

Please ignore the previous comment. 

The current version of code generates a MachinePointerInfo and then uses the MachinePointerInfo version of the DAG.getStore() API call, which actually ignores StackAlignment completely. This version of the API call only considers the Alignment of the Object, and it looks like it was meant to only consider that. 

When we take the route through getStackAlignedMMO, we transfer the alignment information from MachineFrameInfo to the MachineMemOperand it returns. Now we can use the DAG.getStore MMO API version to maintain the Alignment information. 

@arsenm Hope that answers your question

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


More information about the llvm-commits mailing list