[PATCH] D85810: [clang] Pass-through remarks options to lld

Wei Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 11 22:44:33 PDT 2020


weiwang created this revision.
Herald added subscribers: cfe-commits, dexonsmith.
Herald added a project: clang.
weiwang requested review of this revision.

Propagate driver commandline remarks options to link. Pass-through happens when:

1. LTO is enabled;
2. Single arch target is specified;
3. The linker is lld;

This gives novice user a convenient way to collect and filter remarks throughout
a typical toolchain invocation with sample profile and LTO using single switch
from the clang driver.

A typical use of this option from clang command-line:

- Using -Rpass* options to print remarks to screen:

`clang -fuse-ld=lld -flto=thin -fprofile-sample-use=foo_sample.txt

  -Rpass=inline -Rpass-missed=inline -Rpass-analysis=inline
  -fdiagnostics-show-hotness -fdiagnostics-hotness-threshold=100 -o foo foo.cpp`

Remarks will be dumped to screen from both pre-lto and lto compilation.

- Using serialized remarks options

`clang -fuse-ld=lld -flto=thin -fprofile-sample-use=foo_sample.txt

  -fsave-optimization-record
  -fdiagnostics-show-hotness -fdiagnostics-hotness-threshold=100 -o foo foo.cpp`

This will produce multiple yaml files containing optimization remarks:

1. foo.opt.yaml : remarks from pre-lto
2. foo.opt.ld.yaml.thin.1.yaml: remark during lto


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85810

Files:
  clang/include/clang/Driver/Driver.h
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/test/Driver/remarks-pass-through.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85810.284969.patch
Type: text/x-patch
Size: 7581 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200812/2113d7e4/attachment.bin>


More information about the cfe-commits mailing list