Update entry count for cold calls
authorDavid Callahan <dcallahan@fb.com>
Thu, 24 Jan 2019 00:55:23 +0000 (00:55 +0000)
committerDavid Callahan <dcallahan@fb.com>
Thu, 24 Jan 2019 00:55:23 +0000 (00:55 +0000)
commitd2eeb2516dcf960932f51cb0988f689a3bc99634
tree70e1c60176e962d99d44e969402d6e33ad3da08d
parent7876c0ecf22f291fcbaf9ba507bad31e3d0bf1c4
Update entry count for cold calls

Summary:
Profile sample files include the number of times each entry or inlined
call site is sampled. This is translated into the entry count metadta
on functions.

When sample data is being read, if a call site that was inlined
in the sample program is considered cold and not inlined, then
the entry count of the out-of-line functions does not reflect
the current compilation.

In this patch, we note call sites where the function was not inlined
and as a last action of the sample profile loading, we update the
called function's entry count to reflect the calls from these
call sites which are not included in the profile file.

Reviewers: danielcdh, wmi, Kader, modocache

Reviewed By: wmi

Subscribers: davidxl, eraman, llvm-commits

Differential Revision: https://reviews.llvm.org/D52845

llvm-svn: 352001
llvm/include/llvm/Transforms/Utils/Cloning.h
llvm/lib/Transforms/IPO/SampleProfile.cpp
llvm/lib/Transforms/Utils/InlineFunction.cpp
llvm/test/Transforms/SampleProfile/Inputs/entry_counts_cold.prof [new file with mode: 0644]
llvm/test/Transforms/SampleProfile/entry_counts_cold.ll [new file with mode: 0644]