[Remarks] Add -foptimization-record-passes to filter remark emission
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>
Tue, 12 Mar 2019 20:28:50 +0000 (20:28 +0000)
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>
Tue, 12 Mar 2019 20:28:50 +0000 (20:28 +0000)
commit20fff32b7d1f1a1bd417b22aa9f26ededd97a3e5
tree3d306ab2527a4bfcf4cfc24a9a82cbea6b476559
parenta54d580350cd5779ee7bd119fd2beffe3097472e
[Remarks] Add -foptimization-record-passes to filter remark emission

Currently we have -Rpass for filtering the remarks that are displayed as
diagnostics, but when using -fsave-optimization-record, there is no way
to filter the remarks while generating them.

This adds support for filtering remarks by passes using a regex.
Ex: `clang -fsave-optimization-record -foptimization-record-passes=inline`

will only emit the remarks coming from the pass `inline`.

This adds:

* `-fsave-optimization-record` to the driver
* `-opt-record-passes` to cc1
* `-lto-pass-remarks-filter` to the LTOCodeGenerator
* `--opt-remarks-passes` to lld
* `-pass-remarks-filter` to llc, opt, llvm-lto, llvm-lto2
* `-opt-remarks-passes` to gold-plugin

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

llvm-svn: 355964
32 files changed:
clang/include/clang/Basic/CodeGenOptions.h
clang/include/clang/Driver/CC1Options.td
clang/include/clang/Driver/Options.td
clang/lib/CodeGen/BackendUtil.cpp
clang/lib/CodeGen/CodeGenAction.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Driver/ToolChains/Darwin.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGen/opt-record-MIR.c
clang/test/CodeGen/opt-record.c
clang/test/Driver/darwin-ld.c
clang/test/Driver/opt-record.c
lld/ELF/Config.h
lld/ELF/Driver.cpp
lld/ELF/LTO.cpp
lld/ELF/Options.td
lld/docs/ld.lld.1
lld/test/ELF/lto/opt-remarks.ll
llvm/include/llvm/IR/RemarkStreamer.h
llvm/include/llvm/LTO/Config.h
llvm/include/llvm/LTO/LTO.h
llvm/lib/IR/RemarkStreamer.cpp
llvm/lib/LTO/LTO.cpp
llvm/lib/LTO/LTOBackend.cpp
llvm/lib/LTO/LTOCodeGenerator.cpp
llvm/lib/LTO/ThinLTOCodeGenerator.cpp
llvm/test/LTO/Resolution/X86/diagnostic-handler-remarks.ll
llvm/test/ThinLTO/X86/diagnostic-handler-remarks.ll
llvm/tools/gold/gold-plugin.cpp
llvm/tools/llc/llc.cpp
llvm/tools/llvm-lto2/llvm-lto2.cpp
llvm/tools/opt/opt.cpp