[PATCH] D70653: [AutoFDO] Properly merge context-sensitive profile of inlinee back to outlined function

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 24 23:37:52 PST 2019


wenlei created this revision.
wenlei added reviewers: wmi, davidxl.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

When sample profile loader decides not to inline a previously inlined call-site, we adjust the profile of outlined function simply by scaling up its profile counts by call-site count. This means the context-sensitive profile of that inlined instance will be thrown away. This commit try to keep context-sensitive profile for such cases:

- Instead of scaling outlined function's profile, we now properly merge the FunctionSamples of inlined instance into outlined function, including all recursively inlined profile.
- Instead of adjusting the profile for negative inline decision at the end of the sample profile loader pass, we do the profile merge right after processing each function. This change paired with top-down ordering of annotation/inline-replay (a separate diff) will make sure we recursively merge profile back before the profile is used for annotation and inline replay.

A new switch -sample-profile-merge-inlinee is added to enable the new profile merge for tuning. It should be the default behavior eventually.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70653

Files:
  llvm/include/llvm/ProfileData/SampleProfReader.h
  llvm/lib/Transforms/IPO/SampleProfile.cpp
  llvm/test/Transforms/SampleProfile/Inputs/inline-mergeprof.prof
  llvm/test/Transforms/SampleProfile/inline-mergeprof.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70653.230836.patch
Type: text/x-patch
Size: 8400 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191125/e9e21763/attachment.bin>


More information about the llvm-commits mailing list