[PATCH] D138893: [llvm-profdata] Use flattening sample profile in profile supplementation

Rong Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 21:27:39 PST 2022


xur created this revision.
xur added a reviewer: davidxl.
Herald added subscribers: wenlei, kristof.beyls.
Herald added a project: All.
xur requested review of this revision.
Herald added a project: LLVM.

We need to flatten the SampleFDO profile in profile supplementation
because the InstrFDO profile does not have inlined callsite counters.
Without flattening profile, FDO optimizations are not stable:
we will not supplement the second generation profile when the modified
functions are all inlined.

This patch fixes this issue: we will flatten the profile for functions
that appears in FDO profile.

Note that we only need to find the hot/warm functions in SampleFDO
profile, so we will not perform a full flatten. We will use
a DFS traversal to compute the accumulated entry count and max bodycount.
This is much cheaper than full flattening.


https://reviews.llvm.org/D138893

Files:
  llvm/test/tools/llvm-profdata/Inputs/flatten_instr.proftext
  llvm/test/tools/llvm-profdata/Inputs/flatten_sample.proftext
  llvm/test/tools/llvm-profdata/suppl-instr-with-sample-flatten.test
  llvm/tools/llvm-profdata/llvm-profdata.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138893.478452.patch
Type: text/x-patch
Size: 6912 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221129/4387421f/attachment.bin>


More information about the llvm-commits mailing list