[llvm] 9978e0e - [llvm-profdata] Allow overlap/similarity comparison to use custom hot threshold cutoff

Wenlei He via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 10 13:43:39 PDT 2021


Author: Wenlei He
Date: 2021-10-10T13:30:18-07:00
New Revision: 9978e0e475eb707f4445699dd27bf521c21594e9

URL: https://github.com/llvm/llvm-project/commit/9978e0e475eb707f4445699dd27bf521c21594e9
DIFF: https://github.com/llvm/llvm-project/commit/9978e0e475eb707f4445699dd27bf521c21594e9.diff

LOG: [llvm-profdata] Allow overlap/similarity comparison to use custom hot threshold cutoff

Allow overlap/similarity comparison to use custom hot threshold cutoff, instead of using hard coded 990000 as hot cutoff.

Differential Revision: https://reviews.llvm.org/D111385

Added: 
    

Modified: 
    llvm/tools/llvm-profdata/llvm-profdata.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp
index a153582ac929d..7d53b05457db3 100644
--- a/llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -1915,22 +1915,13 @@ std::error_code SampleOverlapAggregator::loadProfiles() {
 
   // Load BaseHotThreshold and TestHotThreshold as 99-percentile threshold in
   // profile summary.
-  const uint64_t HotCutoff = 990000;
   ProfileSummary &BasePS = BaseReader->getSummary();
-  for (const auto &SummaryEntry : BasePS.getDetailedSummary()) {
-    if (SummaryEntry.Cutoff == HotCutoff) {
-      BaseHotThreshold = SummaryEntry.MinCount;
-      break;
-    }
-  }
-
   ProfileSummary &TestPS = TestReader->getSummary();
-  for (const auto &SummaryEntry : TestPS.getDetailedSummary()) {
-    if (SummaryEntry.Cutoff == HotCutoff) {
-      TestHotThreshold = SummaryEntry.MinCount;
-      break;
-    }
-  }
+  BaseHotThreshold =
+      ProfileSummaryBuilder::getHotCountThreshold(BasePS.getDetailedSummary());
+  TestHotThreshold =
+      ProfileSummaryBuilder::getHotCountThreshold(TestPS.getDetailedSummary());
+
   return std::error_code();
 }
 


        


More information about the llvm-commits mailing list