[PATCH] D50370: [SampleFDO] Fix a bug in getOrCompHotCountThreshold/getOrCompColdCountThreshold

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 7 11:13:48 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL339162: [SampleFDO] Fix a bug in getOrCompHotCountThreshold/getOrCompColdCountThreshold (authored by wmi, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D50370?vs=159431&id=159554#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D50370

Files:
  llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp
  llvm/trunk/test/Transforms/SampleProfile/Inputs/function_metadata.prof
  llvm/trunk/test/Transforms/SampleProfile/function_metadata.ll


Index: llvm/trunk/test/Transforms/SampleProfile/function_metadata.ll
===================================================================
--- llvm/trunk/test/Transforms/SampleProfile/function_metadata.ll
+++ llvm/trunk/test/Transforms/SampleProfile/function_metadata.ll
@@ -27,8 +27,10 @@
 }
 
 ; GUIDs of foo, bar, foo1, foo2 and foo3 should be included in the metadata to
-; make sure hot inline stacks are imported.
-; CHECK: ![[ENTRY_TEST]] = !{!"function_entry_count", i64 1, i64 2494702099028631698, i64 6699318081062747564, i64 7546896869197086323, i64 7682762345278052905,  i64 -7908226060800700466, i64 -2012135647395072713}
+; make sure hot inline stacks are imported. The total count of baz is lower
+; than the hot cutoff threshold and its GUID should not be included in the
+; metadata.
+; CHECK: ![[ENTRY_TEST]] = !{!"function_entry_count", i64 1, i64 2494702099028631698, i64 6699318081062747564, i64 7682762345278052905,  i64 -7908226060800700466, i64 -2012135647395072713}
 
 ; Check GUIDs for both foo and foo_available are included in the metadata to
 ; make sure the liveness analysis can capture the dependency from test_liveness
Index: llvm/trunk/test/Transforms/SampleProfile/Inputs/function_metadata.prof
===================================================================
--- llvm/trunk/test/Transforms/SampleProfile/Inputs/function_metadata.prof
+++ llvm/trunk/test/Transforms/SampleProfile/Inputs/function_metadata.prof
@@ -1,4 +1,6 @@
 test:10000:0
+ 2: 100
+ 3: 100
  3: foo:1000
   3: bar:200
    4: baz:10
Index: llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp
===================================================================
--- llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp
+++ llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp
@@ -226,13 +226,13 @@
 uint64_t ProfileSummaryInfo::getOrCompHotCountThreshold() {
   if (!HotCountThreshold)
     computeThresholds();
-  return HotCountThreshold && HotCountThreshold.getValue();
+  return HotCountThreshold ? HotCountThreshold.getValue() : UINT64_MAX;
 }
 
 uint64_t ProfileSummaryInfo::getOrCompColdCountThreshold() {
   if (!ColdCountThreshold)
     computeThresholds();
-  return ColdCountThreshold && ColdCountThreshold.getValue();
+  return ColdCountThreshold ? ColdCountThreshold.getValue() : 0;
 }
 
 bool ProfileSummaryInfo::isHotBB(const BasicBlock *B, BlockFrequencyInfo *BFI) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50370.159554.patch
Type: text/x-patch
Size: 2367 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180807/3730a21b/attachment.bin>


More information about the llvm-commits mailing list