[clang] [llvm] [InstrPGO] Instrument sampling profile based cold function (PR #109837)

via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 16 18:01:03 PDT 2024


================
@@ -319,6 +319,29 @@ static cl::opt<unsigned> PGOFunctionCriticalEdgeThreshold(
     cl::desc("Do not instrument functions with the number of critical edges "
              " greater than this threshold."));
 
+static cl::opt<uint64_t> ColdFuncCoverageMaxEntryCount(
+    "cold-function-coverage-max-entry-count", cl::init(0), cl::Hidden,
+    cl::desc("When enabling cold function coverage instrumentation, skip "
+             "instrumenting the function whose entry count is above the given "
+             "value"));
+
+static cl::opt<InstrColdFuncCovMode> InstrumentColdFunctionCoverageMode(
+    "instrument-cold-function-coverage-mode",
+    cl::init(InstrColdFuncCovMode::Conservative), cl::Hidden,
+    cl::desc("Control whether to instrument unprofiled functions for cold "
+             "function coverage."),
+    cl::values(
+        clEnumValN(InstrColdFuncCovMode::Conservative, "conservative",
+                   "Assume unprofiled functions are not cold, skip "
+                   "instrumenting them."),
+        clEnumValN(InstrColdFuncCovMode::Optimistic, "optimistic",
+                   "Treat unprofiled functions as cold and instrument them.")));
+
+cl::opt<bool> InstrumentColdFunctionCoverage(
+    "instrument-cold-function-coverage", cl::init(false), cl::Hidden,
----------------
WenleiHe wrote:

We already have `pgo-function-entry-coverage` flag to ask for coverage. Ideally we want flags to be orthogonal and not overlap. So how about `pgo-instrument-cold-function-only` (add `pgo-` prefix to be consistent)? 

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


More information about the cfe-commits mailing list