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

Ellis Hoag via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 9 11:22:47 PDT 2024


================
@@ -1891,6 +1914,12 @@ static bool skipPGOGen(const Function &F) {
     return true;
   if (F.getInstructionCount() < PGOFunctionSizeThreshold)
     return true;
+  if (InstrumentColdFunctionCoverage) {
+    if (!F.getEntryCount())
+      return InstrumentColdFunctionCoverageMode ==
+             InstrColdFuncCovMode::Conservative;
+    return F.getEntryCount()->getCount() > ColdFuncCoverageMaxEntryCount;
----------------
ellishg wrote:

```suggestion
    if (auto EntryCount = F.getEntryCount())
      return EntryCount->getCount() > ColdFuncCoverageMaxEntryCount;
    return InstrumentColdFunctionCoverageMode ==
             InstrColdFuncCovMode::Conservative;
```

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


More information about the cfe-commits mailing list