[llvm] [VPlan] Factor out logic to common compute costs to helper (NFCI). (PR #153361)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 14 02:01:22 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;
----------------
david-arm wrote:
I think it's worth adding a comment explaining the discrepancy between `IsVector` and VF as it could be confusing.
https://github.com/llvm/llvm-project/pull/153361
More information about the llvm-commits
mailing list