[PATCH] D117598: [llvm-profdata] Use SubCommands to simplify code

Ellis Hoag via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 18 13:14:05 PST 2022


ellis created this revision.
Herald added subscribers: wenlei, hiraditya.
ellis added reviewers: davidxl, wenlei, hoy, xur, weihe, kyulee.
ellis published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Use `cl::SubCommand` to improve the code in `llvm-profdata.cpp` in a few ways.

- Removes arg parsing code to pick which subcommand to run
- Removes custom help message code
- Emits a more standard help message
- Removes redundant options used by multiple subcommands
- Moves all options to one place at the top of the file

Unfortunately, there are a few top-level options that `llvm-profdata` and `llvm-profgen` use. That is why `MergeSubcommand` is defined in `InstrProf.cpp`, so that the subcommand can add these top-level options.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117598

Files:
  llvm/include/llvm/ProfileData/InstrProf.h
  llvm/lib/ProfileData/InstrProf.cpp
  llvm/lib/ProfileData/ProfileSummaryBuilder.cpp
  llvm/lib/ProfileData/SampleProf.cpp
  llvm/lib/ProfileData/SampleProfReader.cpp
  llvm/test/tools/llvm-profdata/same-filename.test
  llvm/test/tools/llvm-profdata/weight-instr.test
  llvm/test/tools/llvm-profdata/weight-sample.test
  llvm/tools/llvm-profdata/llvm-profdata.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117598.400966.patch
Type: text/x-patch
Size: 38680 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220118/72879cb5/attachment-0001.bin>


More information about the llvm-commits mailing list