[PATCH] D45531: [GoldPlugin] Add support for -save-stats=obj.

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 12 10:06:54 PDT 2018


tejohnson added a comment.

A few thoughts/suggestions:

It would be better to add the calls to EnableStatistics and PrintStatisticsJSON to the LTO library, specifically inside LTO::run in LTO.cpp, so that all LTO clients can get the support with just an lto::Config change. E.g. the llvm-lto2 tool, lld.

What about -save-stats=cwd? It seems that both "obj" and "cwd" should be supported. But better than that:

- The -save-stats clang Driver option causes the -stats-file= cc1 option to be set. Better to support a -stats-file= option in gold-plugin and corresponding Config setting LTO, which is more generic than -save-stats.
- Once that is done, you can automatically set the gold-plugin option when -save-stats is passed to the cc1 invocation, in tools::AddGoldPlugin in clang. That simplifies the user model, and the option you need to pass in your corresponding CMake change, which can just be -save-stats=cwd.

Needs a test (assuming it is added to the LTO code, add both a gold and an llvm-lto2 based test).


https://reviews.llvm.org/D45531





More information about the llvm-commits mailing list