[llvm-branch-commits] [llvm] GlobalISel: Improve MMO extended LLT caclulation from size (PR #196398)

Petar Avramovic via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri May 8 05:27:58 PDT 2026


================
@@ -1158,12 +1158,15 @@ class LLVM_ABI MachineFunction {
                                           int64_t Offset, LLT Ty);
   MachineMemOperand *getMachineMemOperand(const MachineMemOperand *MMO,
                                           int64_t Offset, LocationSize Size) {
-    return getMachineMemOperand(
-        MMO, Offset,
-        !Size.isPrecise() ? LLT()
-        : Size.isScalable()
-            ? LLT::scalable_vector(1, 8 * Size.getValue().getKnownMinValue())
-            : LLT::scalar(8 * Size.getValue().getKnownMinValue()));
+    if (!Size.isPrecise())
+      return getMachineMemOperand(MMO, Offset, LLT());
+
+    unsigned SizeInBits = 8 * Size.getValue().getKnownMinValue();
+    LLT Ty = Size.isScalable() ? LLT::scalable_vector(1, SizeInBits)
+             : MMO->getType().isPointerOrPointerVector()
+                 ? LLT::scalar(SizeInBits)
----------------
petar-avramovic wrote:

now that I think about it, this should really be LLT::integer

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


More information about the llvm-branch-commits mailing list