[llvm] 7ee6cf0 - [LV] Fix incorrect cost kind in VPReplicateRecipe::computeCost (#153216)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 18 01:52:34 PDT 2025


Author: David Sherwood
Date: 2025-08-18T09:52:31+01:00
New Revision: 7ee6cf06c8aa611bd55e0cbea263862c64d0a2b0

URL: https://github.com/llvm/llvm-project/commit/7ee6cf06c8aa611bd55e0cbea263862c64d0a2b0
DIFF: https://github.com/llvm/llvm-project/commit/7ee6cf06c8aa611bd55e0cbea263862c64d0a2b0.diff

LOG: [LV] Fix incorrect cost kind in VPReplicateRecipe::computeCost (#153216)

We were incorrectly using the TTI::TCK_RecipThroughput cost kind and
ignoring the kind set in the context.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index fa62547d374cd..0609510ac8212 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -2964,7 +2964,6 @@ InstructionCost VPReplicateRecipe::computeCost(ElementCount VF,
   // transform, avoid computing their cost multiple times for now.
   Ctx.SkipCostComputation.insert(UI);
 
-  TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput;
   Type *ResultTy = Ctx.Types.inferScalarType(this);
   switch (UI->getOpcode()) {
   case Instruction::GetElementPtr:
@@ -2990,7 +2989,7 @@ InstructionCost VPReplicateRecipe::computeCost(ElementCount VF,
     auto Op2Info = Ctx.getOperandInfo(getOperand(1));
     SmallVector<const Value *, 4> Operands(UI->operand_values());
     return Ctx.TTI.getArithmeticInstrCost(
-               UI->getOpcode(), ResultTy, CostKind,
+               UI->getOpcode(), ResultTy, Ctx.CostKind,
                {TargetTransformInfo::OK_AnyValue, TargetTransformInfo::OP_None},
                Op2Info, Operands, UI, &Ctx.TLI) *
            (isSingleScalar() ? 1 : VF.getFixedValue());


        


More information about the llvm-commits mailing list