@@ -2941,7 +2941,7 @@ LoopVectorizationCostModel::getVectorCallCost(CallInst *CI,
29412941 Tys.push_back (ArgOp->getType ());
29422942
29432943 InstructionCost ScalarCallCost =
2944- TTI.getCallInstrCost (CI->getCalledFunction (), RetTy, Tys);
2944+ TTI.getCallInstrCost (CI->getCalledFunction (), RetTy, Tys, CostKind );
29452945
29462946 // If this is an intrinsic we may have a lower cost for it.
29472947 if (getVectorIntrinsicIDForCall (CI, TLI)) {
@@ -6679,7 +6679,8 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,
66796679 InstructionCost MulCost = TTI::TCC_Free;
66806680 ConstantInt *RHS = dyn_cast<ConstantInt>(I->getOperand (1 ));
66816681 if (!RHS || RHS->getZExtValue () != 1 )
6682- MulCost = TTI.getArithmeticInstrCost (Instruction::Mul, VectorTy);
6682+ MulCost =
6683+ TTI.getArithmeticInstrCost (Instruction::Mul, VectorTy, CostKind);
66836684
66846685 // Find the cost of the histogram operation itself.
66856686 Type *PtrTy = VectorType::get (HGram->Load ->getPointerOperandType (), VF);
@@ -6691,7 +6692,7 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,
66916692
66926693 // Add the costs together with the add/sub operation.
66936694 return TTI.getIntrinsicInstrCost (ICA, CostKind) + MulCost +
6694- TTI.getArithmeticInstrCost (I->getOpcode (), VectorTy);
6695+ TTI.getArithmeticInstrCost (I->getOpcode (), VectorTy, CostKind );
66956696 }
66966697 [[fallthrough]];
66976698 }
@@ -7554,6 +7555,16 @@ VectorizationFactor LoopVectorizationPlanner::computeBestVF() {
75547555 if (VPlans.size () == 1 && size (FirstPlan.vectorFactors ()) == 1 )
75557556 return {*FirstPlan.vectorFactors ().begin (), 0 , 0 };
75567557
7558+ LLVM_DEBUG (dbgs () << " LV: Computing best VF using cost kind: "
7559+ << (CM.CostKind == TTI::TCK_RecipThroughput
7560+ ? " Reciprocal Throughput\n "
7561+ : CM.CostKind == TTI::TCK_Latency
7562+ ? " Instruction Latency\n "
7563+ : CM.CostKind == TTI::TCK_CodeSize ? " Code Size\n "
7564+ : CM.CostKind == TTI::TCK_SizeAndLatency
7565+ ? " Code Size and Latency\n "
7566+ : " Unknown\n " ));
7567+
75577568 ElementCount ScalarVF = ElementCount::getFixed (1 );
75587569 assert (hasPlanWithVF (ScalarVF) &&
75597570 " More than a single plan/VF w/o any plan having scalar VF" );
0 commit comments