[llvm] [VPlan] Compute cost of replicating calls in VPlan. (NFCI) (PR #154291)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 21 02:06:44 PDT 2025


================
@@ -3017,8 +3010,43 @@ InstructionCost VPReplicateRecipe::computeCost(ElementCount VF,
     SmallVector<Type *, 4> Tys;
     for (VPValue *ArgOp : drop_end(operands()))
       Tys.push_back(Ctx.Types.inferScalarType(ArgOp));
+
     Type *ResultTy = Ctx.Types.inferScalarType(this);
-    return Ctx.TTI.getCallInstrCost(CalledFn, ResultTy, Tys, Ctx.CostKind);
+    InstructionCost ScalarCallCost =
+        Ctx.TTI.getCallInstrCost(CalledFn, ResultTy, Tys, Ctx.CostKind);
----------------
david-arm wrote:

I wonder if the old code was even correct? It looks like in the legacy cost model (`LoopVectorizationCostModel::getVectorCallCost`) we selected the min of `getVectorIntrinsicCost` and `TTI.getCallInstrCost` if we're invoking an intrinsic.

https://github.com/llvm/llvm-project/pull/154291


More information about the llvm-commits mailing list