[llvm] [PGO] Fix incorrect count threshold calculation when 0% cutoff (PR #117359)

Ellis Hoag via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 5 13:51:53 PST 2024


================
@@ -77,9 +77,18 @@ static const uint32_t DefaultCutoffsData[] = {
 const ArrayRef<uint32_t> ProfileSummaryBuilder::DefaultCutoffs =
     DefaultCutoffsData;
 
+// An entry for the 0th percentile to correctly calculate hot/cold count
+// thresholds when -profile-summary-cutoff-hot/cold is 0.  If the hot cutoff is
+// 0, no sample counts are treated as hot.  If the cold cutoff is 0, all sample
+// counts are treated as cold.  Assumes there is no UINT64_MAX sample counts.
----------------
ellishg wrote:

Is this a typo? Or am I misunderstanding these flags?

```suggestion
// An entry for the 0th percentile to correctly calculate hot/cold count
// thresholds when -profile-summary-cutoff-hot/cold is 0.  If the hot cutoff is
// 0, all sample counts are treated as hot.  If the cold cutoff is 0, no sample
// counts are treated as cold.  Assumes there is no UINT64_MAX sample counts.
```

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


More information about the llvm-commits mailing list