[llvm] [MemoryLocation] Size Scalable Masked MemOps (PR #154785)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 21 08:39:19 PDT 2025


================
@@ -213,20 +236,30 @@ MemoryLocation MemoryLocation::getForArgument(const CallBase *Call,
               cast<ConstantInt>(II->getArgOperand(0))->getZExtValue()),
           AATags);
 
-    case Intrinsic::masked_load:
+    case Intrinsic::masked_load: {
       assert(ArgIdx == 0 && "Invalid argument index");
-      return MemoryLocation(
-          Arg,
-          LocationSize::upperBound(DL.getTypeStoreSize(II->getType())),
-          AATags);
 
-    case Intrinsic::masked_store:
+      Type *Ty = II->getType();
+      auto KnownScalableSize =
+          getFixedTypeFromScalableMemOp(II->getOperand(2), Ty);
+      if (KnownScalableSize)
----------------
david-arm wrote:

You could do:

```
  if (auto KnownScalableSize = getFixedTypeFromScalableMemOp(II->getOperand(2), Ty))
    Ty = *KnownScalableSize;
  return MemoryLocation(Arg, DL.getTypeStoreSize(Ty), AATags);
```

and similarly for the store below.

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


More information about the llvm-commits mailing list