Skip to content

Commit

Permalink
Revert "[VPlan] Implement VPWidenCallRecipe::computeCost (NFCI). (llv…
Browse files Browse the repository at this point in the history
…m#106047)"

Breaks build of 534.hpgmg

This reverts commit
9ccf825 and
b0de7fa [VPlan] Use op from underlying call in computeCost if needed.

Change-Id: Ib8b10cc72bfb787d5f295971aa871e625148aa9d
  • Loading branch information
ronlieb committed Sep 2, 2024
1 parent aacf4d7 commit 9fef9db
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 49 deletions.
4 changes: 0 additions & 4 deletions llvm/lib/Transforms/Vectorize/VPlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -1565,10 +1565,6 @@ class VPWidenCallRecipe : public VPSingleDefRecipe {
/// Produce a widened version of the call instruction.
void execute(VPTransformState &State) override;

/// Return the cost of this VPWidenCallRecipe.
InstructionCost computeCost(ElementCount VF,
VPCostContext &Ctx) const override;

Function *getCalledScalarFunction() const {
return cast<Function>(getOperand(getNumOperands() - 1)->getLiveInIRValue());
}
Expand Down
45 changes: 0 additions & 45 deletions llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,51 +925,6 @@ void VPWidenCallRecipe::execute(VPTransformState &State) {
}
}

InstructionCost VPWidenCallRecipe::computeCost(ElementCount VF,
VPCostContext &Ctx) const {
TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput;
if (Variant) {
return Ctx.TTI.getCallInstrCost(nullptr, Variant->getReturnType(),
Variant->getFunctionType()->params(),
CostKind);
}

FastMathFlags FMF;
// TODO: Manage flags via VPRecipeWithIRFlags.
if (auto *FPMO = dyn_cast_or_null<FPMathOperator>(getUnderlyingValue()))
FMF = FPMO->getFastMathFlags();

// Some backends analyze intrinsic arguments to determine cost. Use the
// underlying value for the operand if it has one. Otherwise try to use the
// operand of the underlying call instruction, if there is one. Otherwise
// clear Arguments.
// TODO: Rework TTI interface to be independent of concrete IR values.
SmallVector<const Value *> Arguments;
for (const auto &[Idx, Op] : enumerate(operands())) {
auto *V = Op->getUnderlyingValue();
if (!V) {
if (auto *UI = dyn_cast_or_null<CallBase>(getUnderlyingValue())) {
Arguments.push_back(UI->getArgOperand(Idx));
continue;
}
Arguments.clear();
break;
}
Arguments.push_back(V);
}

Type *RetTy =
ToVectorTy(Ctx.Types.inferScalarType(this->getVPSingleValue()), VF);
SmallVector<Type *> ParamTys;
for (unsigned I = 0; I != getNumOperands(); ++I)
ParamTys.push_back(
ToVectorTy(Ctx.Types.inferScalarType(getOperand(I)), VF));

IntrinsicCostAttributes CostAttrs(VectorIntrinsicID, RetTy, Arguments,
ParamTys, FMF);
return Ctx.TTI.getIntrinsicInstrCost(CostAttrs, CostKind);
}

#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
void VPWidenCallRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const {
Expand Down
4 changes: 4 additions & 0 deletions revert_patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,7 @@ Revert: Depends upon older [ctx_prof] reverts
1022323c9b7c [ctx_prof] Move the "from json" logic more centrally to reuse it from test. (#106129)
contact : mhalk (Michael Halkenhaeuser)
---
Breaks build of 534.hpgmg
9ccf82543d50 - [VPlan] Implement VPWidenCallRecipe::computeCost (NFCI). (#106047)
b0de7fa46687 [VPlan] Use op from underlying call in computeCost if needed.
---

0 comments on commit 9fef9db

Please sign in to comment.