[llvm] [CostModel][Test] Replace multiple flags with `-intrinsic-cost-strategy` (PR #128885)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 26 07:01:08 PST 2025


================
@@ -40,14 +40,24 @@ static cl::opt<TargetTransformInfo::TargetCostKind> CostKind(
                clEnumValN(TargetTransformInfo::TCK_SizeAndLatency,
                           "size-latency", "Code size and latency")));
 
-static cl::opt<bool> TypeBasedIntrinsicCost("type-based-intrinsic-cost",
-    cl::desc("Calculate intrinsics cost based only on argument types"),
-    cl::init(false));
+enum class IntrinsicCostStrategy {
+  InstructionCost,
+  IntrinsicCost,
+  TypeBasedIntrinsicCost,
+};
 
-static cl::opt<bool> PreferIntrinsicCost(
-    "prefer-intrinsic-cost",
-    cl::desc("Prefer using getIntrinsicInstrCost over getInstructionCost"),
-    cl::init(false));
+static cl::opt<IntrinsicCostStrategy> IntrinsicCost(
+    "intrinsic-cost-strategy",
+    cl::desc("Costing strategy for intrinsic instructions"),
+    cl::init(IntrinsicCostStrategy::InstructionCost),
+    cl::values(
+        clEnumValN(IntrinsicCostStrategy::InstructionCost, "instruction-cost",
+                   "Use TargetTransformInfo::getInstructionCost"),
+        clEnumValN(IntrinsicCostStrategy::IntrinsicCost, "intrinsic-cost",
+                   "Use TargetTransformInfo::getIntrinsicInstrCost"),
+        clEnumValN(IntrinsicCostStrategy::TypeBasedIntrinsicCost,
+                   "type-based-intrinsic-cost",
+                   "Calculate intrinsics cost based only on argument types")));
----------------
david-arm wrote:

nit: Should this be "Calculate the intrinsic cost based only on argument types"?

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


More information about the llvm-commits mailing list