[llvm] [VPlan] Move call widening decision to VPlan. (NFCI) (PR #195518)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Mon May 4 08:30:21 PDT 2026
================
@@ -3634,6 +3609,39 @@ InstructionCost VPReplicateRecipe::computeCost(ElementCount VF,
return Ctx.getLegacyCost(UI, VF);
}
+InstructionCost VPReplicateRecipe::computeScalarCallCost(
+ Function *CalledFn, Type *ResultTy, ArrayRef<const VPValue *> ArgOps,
+ bool IsSingleScalar, ElementCount VF, VPCostContext &Ctx) {
+ SmallVector<Type *, 4> Tys = map_to_vector<4>(
+ ArgOps, [&](const VPValue *Op) { return Ctx.Types.inferScalarType(Op); });
+
+ Intrinsic::ID IntrinID = CalledFn->getIntrinsicID();
+ auto GetIntrinsicCost = [&] {
+ return Ctx.TTI.getIntrinsicInstrCost(
+ IntrinsicCostAttributes(IntrinID, ResultTy, Tys), Ctx.CostKind);
+ };
----------------
artagnon wrote:
Hm, would be good to avoid the footgun when IntrinID isn't present by checking it in the lambda and returning a std::nullopt or something?
https://github.com/llvm/llvm-project/pull/195518
More information about the llvm-commits
mailing list