@@ -3345,7 +3345,7 @@ LoopVectorizationCostModel::getDivRemSpeculationCost(Instruction *I,
33453345 // Scale the cost by the probability of executing the predicated blocks.
33463346 // This assumes the predicated block for each vector lane is equally
33473347 // likely.
3348- ScalarizationCost = ScalarizationCost / getReciprocalPredBlockProb ( );
3348+ ScalarizationCost = ScalarizationCost / getPredBlockCostDivisor (CostKind );
33493349 }
33503350 InstructionCost SafeDivisorCost = 0 ;
33513351
@@ -5515,8 +5515,7 @@ InstructionCost LoopVectorizationCostModel::computePredInstDiscount(
55155515 }
55165516
55175517 // Scale the total scalar cost by block probability.
5518- if (CostKind != TTI::TCK_CodeSize)
5519- ScalarCost /= getReciprocalPredBlockProb ();
5518+ ScalarCost /= getPredBlockCostDivisor (CostKind);
55205519
55215520 // Compute the discount. A non-negative discount means the vector version
55225521 // of the instruction costs more, and scalarizing would be beneficial.
@@ -5568,9 +5567,8 @@ InstructionCost LoopVectorizationCostModel::expectedCost(ElementCount VF) {
55685567 // the predicated block, if it is an if-else block. Thus, scale the block's
55695568 // cost by the probability of executing it. blockNeedsPredication from
55705569 // Legal is used so as to not include all blocks in tail folded loops.
5571- if (VF.isScalar () && Legal->blockNeedsPredication (BB) &&
5572- CostKind != TTI::TCK_CodeSize)
5573- BlockCost /= getReciprocalPredBlockProb ();
5570+ if (VF.isScalar () && Legal->blockNeedsPredication (BB))
5571+ BlockCost /= getPredBlockCostDivisor (CostKind);
55745572
55755573 Cost += BlockCost;
55765574 }
@@ -5648,8 +5646,7 @@ LoopVectorizationCostModel::getMemInstScalarizationCost(Instruction *I,
56485646 // conditional branches, but may not be executed for each vector lane. Scale
56495647 // the cost by the probability of executing the predicated block.
56505648 if (isPredicatedInst (I)) {
5651- if (CostKind != TTI::TCK_CodeSize)
5652- Cost /= getReciprocalPredBlockProb ();
5649+ Cost /= getPredBlockCostDivisor (CostKind);
56535650
56545651 // Add the cost of an i1 extract and a branch
56555652 auto *VecI1Ty =
0 commit comments