Skip to content

Commit 91d4c0d

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.
1 parent 1b1b83f commit 91d4c0d

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
@@ -3154,6 +3154,19 @@ InstructionCost VPReplicateRecipe::computeCost(ElementCount VF,
31543154
return *getCostForRecipeWithOpcode(getOpcode(), ElementCount::getFixed(1),
31553155
Ctx) *
31563156
(isSingleScalar() ? 1 : VF.getFixedValue());
3157+
case Instruction::SDiv:
3158+
case Instruction::UDiv:
3159+
case Instruction::SRem:
3160+
case Instruction::URem: {
3161+
InstructionCost ScalarCost = *getCostForRecipeWithOpcode(
3162+
getOpcode(), ElementCount::getFixed(1), Ctx);
3163+
if (isSingleScalar())
3164+
return ScalarCost;
3165+
3166+
return ScalarCost * VF.getFixedValue() +
3167+
Ctx.getScalarizationOverhead(Ctx.Types.inferScalarType(this),
3168+
to_vector(operands()), VF);
3169+
}
31573170
case Instruction::Load:
31583171
case Instruction::Store: {
31593172
if (isSingleScalar()) {

0 commit comments

Comments
 (0)