[PATCH] D70750: [AutoFDO] Inline replay for cold/small callees from sample profile loader

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 26 16:05:38 PST 2019


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

Sample profile loader of AutoFDO tries to replay previous inlining using context sensitive profile. The replay only repeats inlining if the call site block is hot. As a result it punts inlining of small functions, some of which can be beneficial for size, and will still be inlined by CSGCC inliner later. The oscillation between sample profile loader's inlining and regular CGSSC inlining cause unnecessary loss of context-sensitive profile. It doesn't have much impact for inline decision itself, but it negatively affects post-inline profile quality as CGSCC inliner have to scale counts which is not as accurate as the original context sensitive profile, and bad post-inline profile can misguide code layout.

This change added regular Inline Cost calculation for sample profile loader, so we can inline small functions upfront under switch -sample-profile-inline-size. In addition -sample-profile-cold-inline-threshold is added so we can tune the separate size threshold - currently the default is chosen to be the same as regular inliner's cold call-site threshold. Last, -sample-profile-reinline-all is added to replay all inlining from previous compilation - this is for tuning only and the purpose is to avoid loss of context-sensitivity due to inlining churn at the cost of not using context-sensitive profile to drive inlining.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70750

Files:
  llvm/lib/Transforms/IPO/SampleProfile.cpp
  llvm/test/Transforms/SampleProfile/Inputs/inline-cold.prof
  llvm/test/Transforms/SampleProfile/inline-cold.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70750.231146.patch
Type: text/x-patch
Size: 8980 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191127/37e2de49/attachment.bin>


More information about the llvm-commits mailing list