[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 23:13:05 PST 2024


================
@@ -1377,6 +1378,21 @@ 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,
+                                             bool isObjectScalable) {
+  auto &MFI = MF.getFrameInfo();
+  int FI = cast<FrameIndexSDNode>(StackPtr)->getIndex();
+  MachinePointerInfo PtrInfo = MachinePointerInfo::getFixedStack(MF, FI);
+  auto objectSize = isObjectScalable ? ~UINT16_C(0) : MFI.getObjectSize(FI);
----------------
davemgreen wrote:

UINT16_C should be UINT64_C. It is probably better to make sure objectSize is a uint64_t too (and use the name ObjectSize - llvm prefers capitalized variable names)

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


More information about the llvm-commits mailing list