HomePhabricator

[clang] Pass-through remarks options to linker

Authored by weiwang on Oct 27 2020, 5:11 PM.

Description

[clang] Pass-through remarks options to linker

Summary:
Propagate driver commandline remarks options to linker when LTO is enabled.

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

      Differential Revision: https://reviews.llvm.org/D85810

Details

Committed
weiwangOct 27 2020, 5:23 PM
Differential Revision
D85810: [clang] Pass-through remarks options to linker
Parents
rGbcb8a119df21: [WebAssembly] Add support for DWARF type units
Branches
Unknown
Tags
Unknown