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

David Green via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 20 07:24:20 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;
----------------
davemgreen wrote:

I think ideally this could have just handled all of the vector types. The vectorizer will use CodeSize costs for minsize nowadays IIRC. This wasn't in review for very long though, so there wasn't much chance to react :) No need to do anything about it - I might look into relaxing it if I find it useful.



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


More information about the llvm-commits mailing list