[SampleFDO] Enable sample-profile-top-down-load and sample-profile-merge-inlinee
authorWei Mi <wmi@google.com>
Tue, 30 Jun 2020 21:32:46 +0000 (14:32 -0700)
committerWei Mi <wmi@google.com>
Wed, 8 Jul 2020 16:23:18 +0000 (09:23 -0700)
commite32469a140374737ad0ece395d5b52444bd94cd1
treee0110afea91e9442c6195a77f4345e28dc92329f
parentcca8578efab096fddcb0134b28b17f4758e9afa0
[SampleFDO] Enable sample-profile-top-down-load and sample-profile-merge-inlinee
by default.

sample-profile-top-down-load is an internal option which can enable top-down
order of inlining and profile annotation in sample profile load pass. It was
found to be beneficial for better profile annotation.

Recently we found it could also solve some build time issue. Suppose function
A has many callsites in function B. In the last release binary where sample
profile was collected, the outline copy of A is large because there are many
other functions inlined into A. However although all the callsites calling A
in B are inlined, but every inlined body is small (A was inlined into B
before other functions are inlined into A), there is no build time issue in
last release.

In an optimized build using the sample profile collected from last release,
without top-down inlining, we saw a case that A got very large because of
inlining, and then multiple callsites of A got inlined into B, and that led
to a huge B which caused significant build time issue besides profile
annotation issue.

To solve that problem, the patch enables the flag
sample-profile-top-down-load by default. sample-profile-top-down-load can
have better performance when it is enabled together with
sample-profile-merge-inlinee so in this patch we also enable
sample-profile-merge-inlinee by default.

Differential Revision: https://reviews.llvm.org/D82919
llvm/lib/Transforms/IPO/SampleProfile.cpp
llvm/test/Transforms/SampleProfile/inline-mergeprof.ll
llvm/test/Transforms/SampleProfile/inline-topdown.ll