Emit LLVM optimization remarks when enabled with -Cremark

The default diagnostic handler considers all remarks to be disabled by
default unless configured otherwise through LLVM internal flags:
`-pass-remarks`, `-pass-remarks-missed`, and `-pass-remarks-analysis`.
This behaviour makes `-Cremark` ineffective on its own.

Fix this by configuring a custom diagnostic handler that enables
optimization remarks based on the value of `-Cremark` option. With
`-Cremark=all` enabling all remarks.
This commit is contained in:
Tomasz Miąsko 2021-11-12 00:00:00 +00:00
parent b16ac4cbba
commit 6846674c75
4 changed files with 158 additions and 12 deletions

View file

@ -0,0 +1,19 @@
// build-pass
// ignore-pass
// no-system-llvm
// revisions: all inline
// compile-flags: --crate-type=lib -Cdebuginfo=1 -Copt-level=2
// [all] compile-flags: -Cremark=all
// [inline] compile-flags: -Cremark=inline
// error-pattern: inline: f not inlined into g
// dont-check-compiler-stderr
#[no_mangle]
#[inline(never)]
pub fn f() {
}
#[no_mangle]
pub fn g() {
f();
}