[llvm] [AArch64] Refactor and refine cost-model for partial reductions (PR #158641)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 30 13:07:03 PDT 2025


================
@@ -5632,75 +5632,97 @@ InstructionCost AArch64TTIImpl::getPartialReductionCost(
     TTI::PartialReductionExtendKind OpBExtend, std::optional<unsigned> BinOp,
     TTI::TargetCostKind CostKind) const {
   InstructionCost Invalid = InstructionCost::getInvalid();
-  InstructionCost Cost(TTI::TCC_Basic);
 
   if (CostKind != TTI::TCK_RecipThroughput)
     return Invalid;
 
-  // Sub opcodes currently only occur in chained cases.
-  // Independent partial reduction subtractions are still costed as an add
+  if (VF.isScalable() && !ST->isSVEorStreamingSVEAvailable())
----------------
sdesmalen-arm wrote:

I moved it from the existing code, but you're right that this is a bogus check, this can never happen. I've removed it.

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


More information about the llvm-commits mailing list