SamplePGO - Add test for hot/cold inlined functions.
authorDiego Novillo <dnovillo@google.com>
Tue, 24 Nov 2015 22:38:37 +0000 (22:38 +0000)
committerDiego Novillo <dnovillo@google.com>
Tue, 24 Nov 2015 22:38:37 +0000 (22:38 +0000)
commitae86f42b238209b5ba9c55ec267f6cf57f28b9c1
treec9a8cbebf3a2419ce449e7d8aa203ba3a7015a70
parentc3f9891ca7f0c31773e063a22168b936a038bbd1
SamplePGO - Add test for hot/cold inlined functions.

When the original binary is executed and sampled, the resulting profile
contains information on the original inline stack. We currently follow
the original inline plan if we notice that the inlined callsite has more
than 0 samples to it.

A better way is to determine whether the callsite is actually worth
inlining. If the callsite accumulates a small fraction of the samples
spent in the parent function, then we don't want to bother inlining it
(as it means that the callsite is actually cold).

This patch introduces a threshold expressed in percentage of samples
in relation to the parent function.  If the callsite uses less than N%
of the total samples used by its parent, the original inline decision is
not re-applied.

I've set the threshold to the very arbitrary value of 5%. I'm yet to do
any actual experiments to see what's a good value. I wanted to separate
the basic mechanism from the tuning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254034 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/IPO/SampleProfile.cpp
test/Transforms/SampleProfile/inline.ll