mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
rewrite optimization-remarks-dir to rmake
This commit is contained in:
parent
73d7dc7f22
commit
651f02363d
@ -101,7 +101,6 @@ run-make/no-alloc-shim/Makefile
|
||||
run-make/no-builtins-attribute/Makefile
|
||||
run-make/no-duplicate-libs/Makefile
|
||||
run-make/obey-crate-type-flag/Makefile
|
||||
run-make/optimization-remarks-dir/Makefile
|
||||
run-make/output-type-permutations/Makefile
|
||||
run-make/panic-abort-eh_frame/Makefile
|
||||
run-make/pass-linker-flags-flavor/Makefile
|
||||
|
@ -7,13 +7,23 @@
|
||||
//@ needs-profiler-support
|
||||
//@ ignore-cross-compile
|
||||
|
||||
use run_make_support::{run, llvm_profdata, rustc, invalid_utf8_contains};
|
||||
use run_make_support::{invalid_utf8_contains, llvm_profdata, run, rustc};
|
||||
|
||||
fn main() {
|
||||
rustc().profile_generate("profdata").opt().input("foo.rs").output("foo").run();
|
||||
run("foo");
|
||||
llvm_profdata().merge().output("merged.profdata").input("profdata/default_15907418011457399462_0.profraw").run();
|
||||
rustc().profile_use("merged.profdata").opt().input("foo.rs").arg("-Cremark=all").arg("-Zremark-dir=profiles").run();
|
||||
llvm_profdata()
|
||||
.merge()
|
||||
.output("merged.profdata")
|
||||
.input("profdata/default_15907418011457399462_0.profraw")
|
||||
.run();
|
||||
rustc()
|
||||
.profile_use("merged.profdata")
|
||||
.opt()
|
||||
.input("foo.rs")
|
||||
.arg("-Cremark=all")
|
||||
.arg("-Zremark-dir=profiles")
|
||||
.run();
|
||||
// Check that PGO hotness is included in the remark files
|
||||
invalid_utf8_contains("profiles/foo.cba44757bc0621b9-cgu.0.opt.opt.yaml", "Hotness");
|
||||
}
|
||||
|
@ -1,12 +0,0 @@
|
||||
include ../tools.mk
|
||||
|
||||
PROFILE_DIR=$(TMPDIR)/profiles
|
||||
|
||||
all: check_inline check_filter
|
||||
|
||||
check_inline:
|
||||
$(RUSTC) -O foo.rs --crate-type=lib -Cremark=all -Zremark-dir=$(PROFILE_DIR)
|
||||
cat $(PROFILE_DIR)/*.opt.yaml | $(CGREP) -e "inline"
|
||||
check_filter:
|
||||
$(RUSTC) -O foo.rs --crate-type=lib -Cremark=foo -Zremark-dir=$(PROFILE_DIR)
|
||||
cat $(PROFILE_DIR)/*.opt.yaml | $(CGREP) -e -v "inline"
|
26
tests/run-make/optimization-remarks-dir/rmake.rs
Normal file
26
tests/run-make/optimization-remarks-dir/rmake.rs
Normal file
@ -0,0 +1,26 @@
|
||||
// In this test, the function `bar` has #[inline(never)] and the function `foo`
|
||||
// does not. This test outputs LLVM optimization remarks twice - first for all
|
||||
// functions (including `bar`, and the `inline` mention), and then for only `foo`
|
||||
// (should not have the `inline` mention).
|
||||
// See https://github.com/rust-lang/rust/pull/113040
|
||||
|
||||
use run_make_support::{invalid_utf8_contains, invalid_utf8_not_contains, rustc};
|
||||
|
||||
fn main() {
|
||||
rustc()
|
||||
.opt()
|
||||
.input("foo.rs")
|
||||
.crate_type("lib")
|
||||
.arg("-Cremark=all")
|
||||
.arg("-Zremark-dir=profiles_all")
|
||||
.run();
|
||||
invalid_utf8_contains("profiles_all/foo.5be5606e1f6aa79b-cgu.0.opt.opt.yaml", "inline");
|
||||
rustc()
|
||||
.opt()
|
||||
.input("foo.rs")
|
||||
.crate_type("lib")
|
||||
.arg("-Cremark=foo")
|
||||
.arg("-Zremark-dir=profiles_foo")
|
||||
.run();
|
||||
invalid_utf8_not_contains("profiles_foo/foo.5be5606e1f6aa79b-cgu.0.opt.opt.yaml", "inline");
|
||||
}
|
Loading…
Reference in New Issue
Block a user