From 9fef9dbdf344a36954c9c13f52cd919b202e6630 Mon Sep 17 00:00:00 2001 From: Ron Lieberman Date: Mon, 2 Sep 2024 14:28:22 -0500 Subject: [PATCH] Revert "[VPlan] Implement VPWidenCallRecipe::computeCost (NFCI). (#106047)" Breaks build of 534.hpgmg This reverts commit 9ccf82543d509bb5a0f5d0551fc4d6c1913b9a9b and b0de7fa46687 [VPlan] Use op from underlying call in computeCost if needed. Change-Id: Ib8b10cc72bfb787d5f295971aa871e625148aa9d --- llvm/lib/Transforms/Vectorize/VPlan.h | 4 -- .../lib/Transforms/Vectorize/VPlanRecipes.cpp | 45 ------------------- revert_patches.txt | 4 ++ 3 files changed, 4 insertions(+), 49 deletions(-) diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h index bd71dbffa929e7..e7ea5cb23b90d3 100644 --- a/llvm/lib/Transforms/Vectorize/VPlan.h +++ b/llvm/lib/Transforms/Vectorize/VPlan.h @@ -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(getOperand(getNumOperands() - 1)->getLiveInIRValue()); } diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp index e782ac444d0213..c9cee652d2d326 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp @@ -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(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 Arguments; - for (const auto &[Idx, Op] : enumerate(operands())) { - auto *V = Op->getUnderlyingValue(); - if (!V) { - if (auto *UI = dyn_cast_or_null(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 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 { diff --git a/revert_patches.txt b/revert_patches.txt index c7b389a5671e2e..2a925d6cad4baf 100644 --- a/revert_patches.txt +++ b/revert_patches.txt @@ -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. +---