[llvm-profgen] Ignore branch count against outline function
authorwlei <wlei@fb.com>
Thu, 16 Sep 2021 07:31:57 +0000 (00:31 -0700)
committerwlei <wlei@fb.com>
Thu, 7 Oct 2021 21:03:34 +0000 (14:03 -0700)
commitb1a45c62f03ecbeb4544b0c65a01ee4586235a61
tree980f9695c2350595ffc1dec48881a8f7736f6b40
parent6727832c324c1fb43946275d24e2931fde94bc0d
[llvm-profgen] Ignore branch count against outline function

For some transformations like hot-cold split or coro split, it can outline its part of function ranges. Since sample loader is the early stage of backend and no split happens at that time, compiler can't recognize those function, so in llvm-profgen we should attribute the sample to the original function. This is already done for the body range samples since we use the symbols from dwarf which is created before the split.

But for branch samples, the call from master function to its outlined function is actually not a call to the original function, we shouldn't add head/callsie samples for it. So instead of dwarf symbol, we use the symbols from symbol table and ignore those functions with special suffixes(like `.cold` ,`.resume`) for accumulating the callsite/head samples.

Reviewed By: hoy, wenlei

Differential Revision: https://reviews.llvm.org/D110864
llvm/test/tools/llvm-profgen/Inputs/coroutine.perfbin [new file with mode: 0755]
llvm/test/tools/llvm-profgen/Inputs/coroutine.perfscript [new file with mode: 0644]
llvm/test/tools/llvm-profgen/Inputs/func-split.perfbin [new file with mode: 0755]
llvm/test/tools/llvm-profgen/Inputs/func-split.perfscript [new file with mode: 0644]
llvm/test/tools/llvm-profgen/coroutine.test [new file with mode: 0644]
llvm/test/tools/llvm-profgen/func-split.test [new file with mode: 0644]
llvm/tools/llvm-profgen/ProfileGenerator.cpp
llvm/tools/llvm-profgen/ProfileGenerator.h