[all-commits] [llvm/llvm-project] c48687: [clang] Pass-through remarks options to linker

Wei Wang via All-commits all-commits at lists.llvm.org
Tue Oct 27 17:24:47 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: c4868700c58078d0f4c71fab5af2bb73270d2d9f
      https://github.com/llvm/llvm-project/commit/c4868700c58078d0f4c71fab5af2bb73270d2d9f
  Author: Wei Wang <apollo.mobility at gmail.com>
  Date:   2020-10-27 (Tue, 27 Oct 2020)

  Changed paths:
    M clang/lib/Driver/ToolChains/CommonArgs.cpp
    M clang/test/Driver/opt-record.c

  Log Message:
  -----------
  [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




More information about the All-commits mailing list