This is an archive of the discontinued LLVM Phabricator instance.

[PGO] Add --text-format option for llvm-profdata show|merge commands
ClosedPublic

Authored by davidxl on Nov 20 2015, 4:13 PM.

Details

Summary

The new option allows user to

  1. dump raw/indexed format into text profile format
  2. merge the profile and output into text profile format.

Note that Value Profiling data text format is not yet designed. That functionality will be added later.

Diff Detail

Event Timeline

davidxl updated this revision to Diff 40843.Nov 20 2015, 4:13 PM
davidxl retitled this revision from to [PGO] Add --text-format option for llvm-profdata show|merge commands.
davidxl updated this object.
davidxl added reviewers: vsk, xur.
davidxl added a subscriber: llvm-commits.
davidxl updated this revision to Diff 40862.Nov 20 2015, 11:11 PM
davidxl added a reviewer: dnovillo.
  1. Make the merge to text option consistent with sample-profile.
  2. updated documentation.
vsk edited edge metadata.Nov 22 2015, 11:35 PM

Looks good with minor nits

docs/CommandGuide/llvm-profdata.rst
132

Please move your description under the .. option:: -text-format heading. The rest of the descriptions here start with an imperative, so maybe we can use "Enables ..."?

lib/ProfileData/InstrProfWriter.cpp
177

for (uint64_t Count : Func.Counts)?

tools/llvm-profdata/llvm-profdata.cpp
35

Could you handle this in a follow-up commit?

dnovillo added inline comments.Nov 23 2015, 6:53 AM
lib/ProfileData/InstrProfWriter.cpp
188

I would move this functionality into lib/ProfileData itself. See how the sample writers are organized. From llvm-profdata, you can then just select the kind of writer to use.

tools/llvm-profdata/llvm-profdata.cpp
280

Some of the changes in here seem unrelated to the text format changes. Could you send them separately?

davidxl added inline comments.Nov 23 2015, 12:08 PM
lib/ProfileData/InstrProfWriter.cpp
188

The change is in lib/ProfileData. There is no need to create a new InstrProfWriter subtype text -- it is much simpler to just add a new writer interface for text.

tools/llvm-profdata/llvm-profdata.cpp
35

clang-format did this for me. will revert this part.

davidxl updated this revision to Diff 40958.Nov 23 2015, 12:32 PM
davidxl edited edge metadata.
davidxl marked 3 inline comments as done.

Addressed feedbacks from review comments. Also make the show|merge text dump option the same (for consistency).

This revision was automatically updated to reflect the committed changes.
slingn added a subscriber: slingn.Nov 23 2015, 1:04 PM