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

David Green via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 1 05:30:05 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));
----------------
davemgreen wrote:

If this is the uint64_t accessor to getMachineMemOperand then I think you can use ~UINT64_C(0) for an unknown size. There is MemoryLocation::UnknownSize that should be the same value.

There is a patch in #70452 to clean up some of this and make scalable sizes more naturally supported. That patch is a bit sprawling though, so difficult to get past review in its current state. It doesn't alter the MFI.getObjectSize size, but changes some of the other interfaces to handle scalable TypeSizes a little better.

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


More information about the llvm-commits mailing list