[llvm] [AArch64][TTI] Increase cost for masked memory operations requiring splitting (PR #191417)

Graham Hunter via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 10 08:48:25 PDT 2026


================
@@ -4904,6 +4904,13 @@ AArch64TTIImpl::getMaskedMemoryOpCost(const MemIntrinsicCostAttributes &MICA,
   if (VT->getElementCount() == ElementCount::getScalable(1))
     return InstructionCost::getInvalid();
 
+  // If we need to split the memory operation, we will also need to split the
+  // mask. This will likely lead to overestimating the cost in some cases if
+  // multiple memory operations use the same mask, but we often don't have
+  // enough context to figure that out here.
+  if (LT.first > 1)
+    return LT.first * 2;
----------------
huntergr-arm wrote:

Yep, added a check for the element size. Thanks.

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


More information about the llvm-commits mailing list