about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2021-11-28 23:45:17 +0100
committerGitHub <noreply@github.com>2021-11-28 23:45:17 +0100
commit67762ffe35734c14b0aa1b90597dee164e73831a (patch)
tree9cde84b9a4477fdcba7fac9da4eefdb2ac36b759 /src
parent9ef0bcfc6843f510027fd007a4bb2d999514e036 (diff)
parent8fa45295f44febfa7035caeb149b2adfaa58fc50 (diff)
Rollup merge of #90833 - tmiasko:optimization-remarks, r=nikic
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.

Fixes #90924.

r? `@nikic`
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/optimization-remark.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/ui/optimization-remark.rs b/src/test/ui/optimization-remark.rs
new file mode 100644
index 00000000000..7aedb09928b
--- /dev/null
+++ b/src/test/ui/optimization-remark.rs
@@ -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();
+}