[llvm] [TTI] Plumb CostKind through getPartialReductionCost (PR #144953)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 20 07:42:39 PDT 2025


================
@@ -5395,11 +5395,14 @@ AArch64TTIImpl::getSpliceCost(VectorType *Tp, int Index,
 InstructionCost AArch64TTIImpl::getPartialReductionCost(
     unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType,
     ElementCount VF, TTI::PartialReductionExtendKind OpAExtend,
-    TTI::PartialReductionExtendKind OpBExtend,
-    std::optional<unsigned> BinOp) const {
+    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;
----------------
preames wrote:

This is exactly the type of thing which makes a reasonable follow up by a backend owner.  I have no context on the aarch64 instruction expansions and the prior code wasn't a code size estimate at all.  

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


More information about the llvm-commits mailing list