[PATCH] D70655: [AutoFDO] Top-down Inlining for specialization with context-sensitive profile

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 25 00:06:17 PST 2019


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

AutoFDO's sample profile loader processes function in arbitrary source code order, so if I change the order of two functions in source code, the inline decision can change. This also prevented the use of context-sensitive profile to do specialization while inlining. This commit enforces SCC top-down order for sample profile loader. With this change, we can now do specialization, as illustrated by the added test case:

Say if we have A->B->C and D->B->C call path, we want to inline C into B when root inliner is B, but not when root inliner is A or D, this is not possible without enforcing top-down order. E.g. Once C is inlined into B, A and D can only choose to inline (B->C) as a whole or nothing, but what we want is only inline B into A and D, not its recursive callee C. If we process functions in top-down order, this is no longer a problem, which is what this commit is doing.

This change is guarded with a new switch "-sample-profile-top-down-load" for tuning, and it depends on D70653 <https://reviews.llvm.org/D70653>. Eventually, top-down can be the default order for sample profile loader.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70655

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70655.230840.patch
Type: text/x-patch
Size: 11499 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191125/9bad6e21/attachment.bin>


More information about the llvm-commits mailing list