Page MenuHomePhabricator

Metadata support for profile summary
ClosedPublic

Authored by eraman on Feb 25 2016, 4:42 PM.

Details

Summary

This adds support to convert ProfileSummary object to Metadata and create a ProfileSummary object from metadata. This would allow attaching profile summary information to Module allowing optimization passes to use it.

Diff Detail

Event Timeline

eraman updated this revision to Diff 49121.Feb 25 2016, 4:42 PM
eraman retitled this revision from to Metadata support for profile summary.
eraman updated this object.
eraman added reviewers: davidxl, vsk, dnovillo.
eraman added a subscriber: llvm-commits.
dnovillo accepted this revision.Feb 26 2016, 12:11 PM
dnovillo edited edge metadata.

Looks fine to me, though I'm not an expert on MD.

include/llvm/ProfileData/ProfileCommon.h
59

Nit. Do we really need the prefix 'ProfileSummary'? This enum already needs to be referred as 'ProfileSummary::ProfileSummaryKind'. I think 'ProfileSummary::Kind' reads a bit better.

lib/ProfileData/ProfileSummary.cpp
150

s/a MDTuple/an MDTuple/
s/detiled/detailed/

151

s/a MDTuple/an MDTuple/. This happens in a couple other places.

318

s/an/a/

This revision is now accepted and ready to land.Feb 26 2016, 12:11 PM
vsk edited edge metadata.Feb 26 2016, 1:31 PM

Nice!

lib/ProfileData/ProfileSummary.cpp
255

std::vector<ProfileSummaryEntry> shows up enough to warrant having a typedef for it. Maybe that could be a follow-up?

264

nit: I have a slight preference for auto *MDOp : EntriesMD->operands(), but either way is fine.

eraman marked 3 inline comments as done.Feb 26 2016, 2:51 PM
eraman added inline comments.
include/llvm/ProfileData/ProfileCommon.h
59

I agree with that sentiment. I was following the example in Metadata which has an enum named MetadataKind, but I also see some other classes with just the name Kind. So I've renamed it to Kind.

lib/ProfileData/ProfileSummary.cpp
255

In practice, this is going to be of fixed size (the same as DefaultCutoffs). Is SmallVector a better choice instead of std::vector ?

eraman marked an inline comment as done.Feb 29 2016, 5:20 PM

Added a typedef for std::vector<ProfileSummaryEntry>. Will check this in with that change.

eraman closed this revision.Mar 2 2016, 10:58 AM