[AutoFDO] Use getHeadSamplesEstimate instead of getTotalSamples to compute profile...
authorwlei <wlei@fb.com>
Wed, 14 Dec 2022 22:47:37 +0000 (14:47 -0800)
committerwlei <wlei@fb.com>
Thu, 15 Dec 2022 19:21:18 +0000 (11:21 -0800)
commit97e2aeab71c3acfad9dc9df000c88c78686d8092
treef2911f6ec11f539b10f559339f14a8e46a631539
parentec7cffc579737d086addf22bb155e76e5cd30ab3
[AutoFDO] Use getHeadSamplesEstimate instead of getTotalSamples to compute profile callsite staleness

Fix two issues for profile staleness report.

1) It should be more accurate to use the sum of all entry count(`getHeadSamplesEstimate`) for the callsite samples than the total samples, since even the top-level callsite is mismatched, it does affect the inlining but it can still be merged into base profile and used later.

2) I accidentally missed to persist the num of mismatched callsite into binary.

Also added the asm testing to test the decoding of the section.

Reviewed By: hoy, wenlei

Differential Revision: https://reviews.llvm.org/D140063
llvm/lib/Transforms/IPO/SampleProfile.cpp
llvm/test/Transforms/SampleProfile/profile-mismatch.ll
llvm/test/Transforms/SampleProfile/pseudo-probe-profile-mismatch.ll