This is an archive of the discontinued LLVM Phabricator instance.

[ThinLTO] (WIP) Include total static callsite counts in function summaries
Needs ReviewPublic

Authored by tejohnson on Feb 26 2016, 1:50 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

This is built on top of the call graph summary patch D17212.

Note that this contains debugging code and is not the final patch, just
an FYI.

Initially for use in adjusting inline costs to simulate the
LastCallToStaticBonus. Since we can't internalize aggressively for
ThinLTO like in normal LTO, this can be used to give the bonus to
callsites which are the only callsite to a function, which may then be
linker GC'ed if it is inlined. (The inline cost part is a TODO)

Since I think it might also be useful to see which functions have no
calls to them, I am using a 2-bit field to represent this in the bitcode
summary, which means the call count currently saturates at 3.

I found when running this for SPEC cpu2006 that most calls have no
static callsite. It looks like some of this is due to intra-module
inlining in the -O2 -c step, and some is due to indirect callsites
especially C++ virtual calls. To disambiguate these cases we can either
include an address taken bit in the summary, or for even better
information to guide eventual recursive elimination of unreferenced
functions, include the edges in a reference graph (expanded from the
summary call graph).

Diff Detail

Event Timeline

tejohnson updated this revision to Diff 49231.Feb 26 2016, 1:50 PM
tejohnson retitled this revision from to [ThinLTO] (WIP) Include total static callsite counts in function summaries.
tejohnson updated this object.