This is an archive of the discontinued LLVM Phabricator instance.

Interface to attach maximum function count from PGO to module as module flags.
ClosedPublic

Authored by eraman on Nov 25 2015, 4:35 PM.

Details

Summary

This provides interface to get and set maximum function counts to Module. This would allow things like determination of function hotness. The actual setting of this max function count will have to be done in clang.

Diff Detail

Repository
rL LLVM

Event Timeline

eraman updated this revision to Diff 41196.Nov 25 2015, 4:35 PM
eraman retitled this revision from to Interface to attach maximum function count from PGO to module as module flags..
eraman updated this object.
eraman added a reviewer: llvm-commits.
eraman set the repository for this revision to rL LLVM.
eraman added subscribers: davidxl, dnovillo.

I think the inliner/indirect call promoter also needs another meta data at the module level -- that is the max internal BB count (of the program) .

In the longer term, we also need to design better program summary information such as bb counter histogram with respect to exec freq -- but for now, max BB count would be sufficient.

lib/IR/Module.cpp
502 ↗(On Diff #41196)

Format -- put return in a new line.

How is this going to interact with SamplePGO? Currently, I'm testing a change that adds the InlineHint attribute for functions that globally collected a fraction of samples greater than a given threshold. Likewise, for functions that fall below another threshold, they receive the Cold attribute.

The API talks in terms of function counts, how is this related to the entry count I added earlier? What would SamplePGO have to do here?

Thanks.

davidxl accepted this revision.Dec 2 2015, 11:40 AM
davidxl added a reviewer: davidxl.
This revision is now accepted and ready to land.Dec 2 2015, 11:40 AM
eraman added inline comments.Dec 2 2015, 11:48 AM
lib/IR/Module.cpp
502 ↗(On Diff #41196)

clang-format suggests I have the return on the same line.

use clang-format -style LLVM

David

eraman updated this revision to Diff 41661.Dec 2 2015, 1:03 PM
eraman edited edge metadata.

Ran clang-format with the right options.

lgtm.

David

This revision was automatically updated to reflect the committed changes.