Skip to content

Commit 994593f

Browse files
committed
Reapply "[VPlan] Compute cost of scalar (U|S)Div, (U|S)Rem in computeCost (NFCI)."
This reverts commit 9490d58. Recommits de7e3a5 with a fix for an unhandled case, causing crashes in some configs. (cherry picked from commit 91d4c0d)
1 parent 94c5214 commit 994593f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3044,6 +3044,19 @@ InstructionCost VPReplicateRecipe::computeCost(ElementCount VF,
30443044
return *getCostForRecipeWithOpcode(getOpcode(), ElementCount::getFixed(1),
30453045
Ctx) *
30463046
(isSingleScalar() ? 1 : VF.getFixedValue());
3047+
case Instruction::SDiv:
3048+
case Instruction::UDiv:
3049+
case Instruction::SRem:
3050+
case Instruction::URem: {
3051+
InstructionCost ScalarCost = *getCostForRecipeWithOpcode(
3052+
getOpcode(), ElementCount::getFixed(1), Ctx);
3053+
if (isSingleScalar())
3054+
return ScalarCost;
3055+
3056+
return ScalarCost * VF.getFixedValue() +
3057+
Ctx.getScalarizationOverhead(Ctx.Types.inferScalarType(this),
3058+
to_vector(operands()), VF);
3059+
}
30473060
case Instruction::Load:
30483061
case Instruction::Store: {
30493062
if (isSingleScalar()) {

0 commit comments

Comments
 (0)