[llvm-profgen] Update callsite body samples by summing up all call target samples.
authorHongtao Yu <hoy@fb.com>
Fri, 13 May 2022 05:08:18 +0000 (22:08 -0700)
committerHongtao Yu <hoy@fb.com>
Mon, 16 May 2022 16:13:37 +0000 (09:13 -0700)
commitacfd0a345619c9293ac8fa5f690fa78b27a10814
tree870d5548e287a028a8445a93c59405b550efc162
parentf287da8a158113840aeabd04b641d0d2815212f2
[llvm-profgen] Update callsite body samples by summing up all call target samples.

Current profile generation caculcates callsite body samples and call target samples separately. The former is done based on LBR range samples while the latter is done based on branch samples. Note that there's a subtle difference. LBR ranges is formed from two consecutive branch samples. Therefore the last entry in a LBR record will not be counted towards body samples while there's still a chance for it to be counted towards call targets if it is a function call. I'm making sense of the call body samples by updating it to the aggregation of call targets.

Reviewed By: wenlei

Differential Revision: https://reviews.llvm.org/D122609
llvm/include/llvm/ProfileData/SampleProf.h
llvm/test/tools/llvm-profgen/inline-noprobe2.test
llvm/test/tools/llvm-profgen/noinline-noprobe.test
llvm/test/tools/llvm-profgen/update-samples.test [new file with mode: 0644]
llvm/tools/llvm-profgen/ProfileGenerator.cpp
llvm/tools/llvm-profgen/ProfileGenerator.h