[llvm] [VPlan] Factor out logic to common compute costs to helper (NFCI). (PR #153361)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 18 03:53:02 PDT 2025


================
@@ -940,28 +940,88 @@ Value *VPInstruction::generate(VPTransformState &State) {
   }
 }
 
+std::optional<InstructionCost>
+VPRecipeWithIRFlags::getCommonCost(unsigned Opcode, ElementCount VF,
+                                   VPCostContext &Ctx, bool IsVector) const {
+  Type *ScalarTy = Ctx.Types.inferScalarType(this);
+  Type *ResultTy = IsVector ? toVectorTy(ScalarTy, VF) : ScalarTy;
----------------
fhahn wrote:

IsVector is gone now, thanks

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


More information about the llvm-commits mailing list