[CSSPGO] Use merged base profile for hot threshold calculation
authorWenlei He <aktoon@gmail.com>
Wed, 3 Feb 2021 21:27:35 +0000 (13:27 -0800)
committerWenlei He <aktoon@gmail.com>
Sat, 6 Feb 2021 01:51:00 +0000 (17:51 -0800)
commit801d9cc7b94947836ed59a506188fe9659e133dc
tree88ba3a3cbcff0970f6e2e974f583c95f711b76e2
parentd6efb6fc86a6ded63fc50e3a31377a1f4aa33c6e
[CSSPGO] Use merged base profile for hot threshold calculation

Context-sensitive profile effectively split a function profile into many copies each representing the CFG profile of a particular calling context. That makes the count distribution looks more flat as we now have more function profiles each with lower counts, which in turn leads to lower hot thresholds. Now we tells threshold computation to merge context profile first before calculating percentile based cutoffs to compensate for seemingly flat context profile. This can be controlled by swtich `sample-profile-contextless-threshold`.

Earlier measurement showed ~0.4% perf boost with this tuning on spec2k6 for CSSPGO (with pseudo-probe and new inliner).

Differential Revision: https://reviews.llvm.org/D95980
llvm/include/llvm/ProfileData/ProfileCommon.h
llvm/lib/ProfileData/ProfileSummaryBuilder.cpp
llvm/lib/ProfileData/SampleProfReader.cpp
llvm/lib/ProfileData/SampleProfWriter.cpp
llvm/test/Transforms/SampleProfile/csspgo-inline.ll
llvm/test/Transforms/SampleProfile/csspgo-summary.ll [new file with mode: 0644]