[all-commits] [llvm/llvm-project] 532196: [AutoFDO] Top-down Inlining for specialization wit...
WenleiHe via All-commits
all-commits at lists.llvm.org
Thu Dec 5 16:23:16 PST 2019
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 532196d811ad4db1e522012c9d20e4a95aae2eb3
https://github.com/llvm/llvm-project/commit/532196d811ad4db1e522012c9d20e4a95aae2eb3
Author: Wenlei He <aktoon at gmail.com>
Date: 2019-12-05 (Thu, 05 Dec 2019)
Changed paths:
M llvm/lib/Transforms/IPO/SampleProfile.cpp
A llvm/test/Transforms/SampleProfile/Inputs/inline-topdown.prof
A llvm/test/Transforms/SampleProfile/inline-topdown.ll
Log Message:
-----------
[AutoFDO] Top-down Inlining for specialization with context-sensitive profile
Summary:
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. Eventually, top-down can be the default order for sample profile loader.
Reviewers: wmi, davidxl
Subscribers: hiraditya, llvm-commits, tejohnson
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70655
More information about the All-commits
mailing list