This is an archive of the discontinued LLVM Phabricator instance.

[llvm-profdata] Support -detailed-summary for Sample Profile
ClosedPublic

Authored by wenlei on May 2 2020, 8:36 AM.

Details

Summary

Add -detailed-summary support for sample profile dump to match that of instrumentation profile.

Diff Detail

Event Timeline

wenlei created this revision.May 2 2020, 8:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 2 2020, 8:36 AM
wmi added inline comments.May 3 2020, 10:38 PM
llvm/tools/llvm-profdata/llvm-profdata.cpp
839

Can we make it a member function of ProfileSummary? We may use the dump function in other places.

wenlei updated this revision to Diff 261877.May 4 2020, 11:14 AM
wenlei marked 2 inline comments as done.

Update

wenlei added inline comments.May 4 2020, 11:15 AM
llvm/tools/llvm-profdata/llvm-profdata.cpp
839

Sure, moved both to be member functions.

wmi added inline comments.May 4 2020, 2:11 PM
llvm/lib/IR/ProfileSummary.cpp
209–215

Why we need printSummary and printDetailedSummary instead of one print function? printSummary seems only print very limited information in ProfileSummary.

wenlei marked an inline comment as done.May 4 2020, 3:11 PM
wenlei added inline comments.
llvm/lib/IR/ProfileSummary.cpp
209–215

That was mostly for sharing printDetailedSummary between InstrProf and SampleProf for llvm-profdata. The printSummary part is always printed for InstrProf, so separated out in order to share printDetailedSummary.

wmi added inline comments.May 4 2020, 6:04 PM
llvm/lib/IR/ProfileSummary.cpp
209–215

I mean can we have one print function, printSummary for example, and dump everything including the detail inside of it? Is it a problem for InstrProf test?

wenlei marked an inline comment as done.May 4 2020, 9:45 PM
wenlei added inline comments.
llvm/lib/IR/ProfileSummary.cpp
209–215

Yeah, it causes problem for InstrProf tests. Stuff in printSummary is always printed for InstrProfile even without detailed-summary flag, and it's interleaved with other outputs. Tests actually leverage the interleaved structure for checking, so if we combine printSummary with printDetailedSummary, many tests need to be updated, and detail-summary need to be added to many tests too. We could do that, I was trying to avoid that churn though...

wmi added inline comments.May 5 2020, 8:54 AM
llvm/lib/IR/ProfileSummary.cpp
209–215

Ok, then can we let printDetailedSummary just print stuff in DetailedSummary and let printSummary print more information like NumCounts, TotalCounts, ....? It makes what those functions should print a little clearer.

InstrProf can print NumCounts and TotalCounts directly since it has already done that in this way.

wenlei updated this revision to Diff 262265.May 5 2020, 5:08 PM

restructure prints

wenlei marked 2 inline comments as done.May 5 2020, 5:10 PM
wenlei added inline comments.
llvm/lib/IR/ProfileSummary.cpp
209–215

Good point, changed.

wmi accepted this revision.May 5 2020, 6:20 PM

Thanks, LGTM.

This revision is now accepted and ready to land.May 5 2020, 6:20 PM
This revision was automatically updated to reflect the committed changes.
wenlei marked an inline comment as done.