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

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 10 08:15:18 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;
----------------
paulwalker-arm wrote:

Is the element type relevant here? I'm think for i8 vector loads the mask will not require splitting because it'll already be spread across the necessary registers?

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


More information about the llvm-commits mailing list