[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


================
@@ -150,6 +150,29 @@ MemoryLocation::getForDest(const CallBase *CB, const TargetLibraryInfo &TLI) {
   return MemoryLocation::getBeforeOrAfter(UsedV, CB->getAAMetadata());
 }
 
+static std::optional<FixedVectorType *>
+getFixedTypeFromScalableMemOp(Value *Mask, Type *Ty) {
+  auto ActiveLaneMask = dyn_cast<IntrinsicInst>(Mask);
----------------
david-arm wrote:

I think you can rewrite this and the code to get the lo and hi values below by using `match`, i.e.

```
  auto ScalableTy = dyn_cast<ScalableVectorType>(Ty);
  if (!ScalableTy)
    return std::nullopt;

  Value *LaneMaskLo, * LaneMaskHi;
  if (!match(Mask, m_Intrinsic<Intrinsic::get_active_lane_mask>(m_Value(LaneMaskLo), m_Value(LaneMaskHi)))
    return std::nullopt;

  uint64_t NumElts = LaneMaskHi->getZExtValue() - LaneMaskLo->getZExtValue();
  ...
```

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


More information about the llvm-commits mailing list