[llvm] [CodeGen] Use LocationSize for MMO getSize (PR #84751)

David Green via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 12 06:36:50 PDT 2024


================
@@ -1046,9 +1055,16 @@ class LLVM_EXTERNAL_VISIBILITY MachineFunction {
   MachineMemOperand *getMachineMemOperand(const MachineMemOperand *MMO,
                                           int64_t Offset, LLT Ty);
   MachineMemOperand *getMachineMemOperand(const MachineMemOperand *MMO,
-                                          int64_t Offset, uint64_t Size) {
+                                          int64_t Offset, LocationSize Size) {
     return getMachineMemOperand(
-        MMO, Offset, Size == ~UINT64_C(0) ? LLT() : LLT::scalar(8 * Size));
+        MMO, Offset,
+        !Size.hasValue() || Size.isScalable()
----------------
davemgreen wrote:

I think quite a lot of things will construct an MMO with an unknown LocationSize, either directly or from the size in another MMO that was already unknown.

~UINT64_C(0) and MemoryLocation::UnknownSize was used a lot in the past, they have all been changed to LocationSize::beforeOrAfterPointer() as the unknown Size.

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


More information about the llvm-commits mailing list