[llvm] [SelectionDAG] Use unaligned store to move AVX registers onto stack for `extractelement` (PR #78422)

Manish Kausik H via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 1 22:42:33 PST 2024


================
@@ -1377,6 +1378,20 @@ void SelectionDAGLegalize::LegalizeOp(SDNode *Node) {
   }
 }
 
+// Helper function that generates an MMO that considers the alignment of the
+// stack, and the size of the stack object
+static MachineMemOperand *getStackAlignedMMO(SDValue StackPtr,
+                                             MachineFunction &MF) {
+  auto &MFI = MF.getFrameInfo();
+  int FI = cast<FrameIndexSDNode>(StackPtr)->getIndex();
+  MachinePointerInfo PtrInfo = MachinePointerInfo::getFixedStack(MF, FI);
+  MachineMemOperand *MMO =
+      MF.getMachineMemOperand(PtrInfo, MachineMemOperand::MOStore,
+                              MFI.getObjectSize(FI), MFI.getObjectAlign(FI));
----------------
Nirhar wrote:

@davemgreen Thanks for the suggestion! I have included your suggestions in the latest version of the patch, and there was no requirement to change the test `sve-extract-fixed-vector.ll`

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


More information about the llvm-commits mailing list