Skip to content

Commit c866959

Browse files
committed
rewrite pgo-indirect-call-promotion to rmake
1 parent 538cdd4 commit c866959

File tree

4 files changed

+34
-24
lines changed

4 files changed

+34
-24
lines changed

src/tools/compiletest/src/command-list.rs

+1
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
202202
"only-watchos",
203203
"only-windows",
204204
"only-windows-gnu",
205+
"only-windows-msvc",
205206
"only-x86",
206207
"only-x86_64",
207208
"only-x86_64-fortanix-unknown-sgx",

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ run-make/native-link-modifier-whole-archive/Makefile
3535
run-make/no-alloc-shim/Makefile
3636
run-make/no-builtins-attribute/Makefile
3737
run-make/pgo-gen-lto/Makefile
38-
run-make/pgo-indirect-call-promotion/Makefile
3938
run-make/print-calling-conventions/Makefile
4039
run-make/print-target-list/Makefile
4140
run-make/raw-dylib-alt-calling-convention/Makefile

tests/run-make/pgo-indirect-call-promotion/Makefile

-23
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// This test checks that indirect call promotion is performed. The test
2+
// programs calls the same function a thousand times through a function pointer.
3+
// Only PGO data provides the information that it actually always is the same
4+
// function. We verify that the indirect call promotion pass inserts a check
5+
// whether it can make a direct call instead of the indirect call.
6+
// See https://github.com/rust-lang/rust/pull/66631
7+
8+
//@ needs-profiler-support
9+
// Reason: llvm_profdata is used
10+
//@ ignore-cross-compile
11+
// Reason: the compiled binary is executed
12+
13+
use run_make_support::{llvm_filecheck, llvm_profdata, rfs, run, rustc};
14+
15+
fn main() {
16+
// We don't compile `opaque` with either optimizations or instrumentation.
17+
rustc().input("opaque.rs").run();
18+
// Compile the test program with instrumentation
19+
rfs::create_dir("prof_data_dir");
20+
rustc().input("interesting.rs").profile_generate("prof_data_dir").opt().codegen_units(1).run();
21+
rustc().input("main.rs").profile_generate("prof_data_dir").opt().run();
22+
// The argument below generates to the expected branch weights
23+
run("main");
24+
llvm_profdata().merge().output("prof_data_dir/merged.profdata").input("prof_data_dir").run();
25+
rustc()
26+
.input("interesting.rs")
27+
.profile_use("prof_data_dir/merged.profdata")
28+
.opt()
29+
.codegen_units(1)
30+
.emit("llvm-ir")
31+
.run();
32+
llvm_filecheck().patterns("filecheck-patterns.txt").stdin(rfs::read("interesting.ll")).run();
33+
}

0 commit comments

Comments
 (0)