diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
commit | 64d98f8ee037282c35007b64c2649055c56af1db (patch) | |
tree | 5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /src/test/run-make-fulldeps/pgo-indirect-call-promotion | |
parent | Adding debian version 1.67.1+dfsg1-1. (diff) | |
download | rustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/run-make-fulldeps/pgo-indirect-call-promotion')
5 files changed, 0 insertions, 119 deletions
diff --git a/src/test/run-make-fulldeps/pgo-indirect-call-promotion/Makefile b/src/test/run-make-fulldeps/pgo-indirect-call-promotion/Makefile deleted file mode 100644 index 45302215c..000000000 --- a/src/test/run-make-fulldeps/pgo-indirect-call-promotion/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# needs-profiler-support -# ignore-windows-gnu - -# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works -# properly. Since we only have GCC on the CI ignore the test for now. - -include ../tools.mk - -all: - # We don't compile `opaque` with either optimizations or instrumentation. - # We don't compile `opaque` with either optimizations or instrumentation. - $(RUSTC) $(COMMON_FLAGS) opaque.rs - # Compile the test program with instrumentation - mkdir -p "$(TMPDIR)"/prof_data_dir - $(RUSTC) $(COMMON_FLAGS) interesting.rs \ - -Cprofile-generate="$(TMPDIR)"/prof_data_dir -O -Ccodegen-units=1 - $(RUSTC) $(COMMON_FLAGS) main.rs -Cprofile-generate="$(TMPDIR)"/prof_data_dir -O - # The argument below generates to the expected branch weights - $(call RUN,main) || exit 1 - "$(LLVM_BIN_DIR)"/llvm-profdata merge \ - -o "$(TMPDIR)"/prof_data_dir/merged.profdata \ - "$(TMPDIR)"/prof_data_dir - $(RUSTC) $(COMMON_FLAGS) interesting.rs \ - -Cprofile-use="$(TMPDIR)"/prof_data_dir/merged.profdata -O \ - -Ccodegen-units=1 --emit=llvm-ir - cat "$(TMPDIR)"/interesting.ll | "$(LLVM_FILECHECK)" filecheck-patterns.txt diff --git a/src/test/run-make-fulldeps/pgo-indirect-call-promotion/filecheck-patterns.txt b/src/test/run-make-fulldeps/pgo-indirect-call-promotion/filecheck-patterns.txt deleted file mode 100644 index e19c78350..000000000 --- a/src/test/run-make-fulldeps/pgo-indirect-call-promotion/filecheck-patterns.txt +++ /dev/null @@ -1,16 +0,0 @@ -CHECK: define void @call_a_bunch_of_functions({{.*}} { - -# Make sure that indirect call promotion inserted a check against the most -# frequently called function. -CHECK: %{{.*}} = icmp eq {{void \(\)\*|ptr}} %{{.*}}, @function_called_always - -# Check that the call to `function_called_always` was inlined, so that we -# directly call `opaque_f1` from the upstream crate. -CHECK: call void @opaque_f1() - - -# Same checks as above, repeated for the trait object case - -CHECK: define void @call_a_bunch_of_trait_methods({{.*}} -CHECK: %{{.*}} = icmp eq {{void \(\{\}\*\)\*|ptr}} %{{.*}}, {{.*}}@foo -CHECK: tail call void @opaque_f2() diff --git a/src/test/run-make-fulldeps/pgo-indirect-call-promotion/interesting.rs b/src/test/run-make-fulldeps/pgo-indirect-call-promotion/interesting.rs deleted file mode 100644 index 4fd096d62..000000000 --- a/src/test/run-make-fulldeps/pgo-indirect-call-promotion/interesting.rs +++ /dev/null @@ -1,56 +0,0 @@ -#![crate_name="interesting"] -#![crate_type="rlib"] - -extern crate opaque; - -#[no_mangle] -pub fn function_called_always() { - opaque::opaque_f1(); -} - -#[no_mangle] -pub fn function_called_never() { - opaque::opaque_f2(); -} - -#[no_mangle] -pub fn call_a_bunch_of_functions(fns: &[fn()]) { - - // Indirect call promotion transforms the below into something like - // - // for f in fns { - // if f == function_called_always { - // function_called_always() - // } else { - // f(); - // } - // } - // - // where `function_called_always` actually gets inlined too. - - for f in fns { - f(); - } -} - - -pub trait Foo { - fn foo(&self); -} - -impl Foo for u32 { - - #[no_mangle] - fn foo(&self) { - opaque::opaque_f2(); - } -} - -#[no_mangle] -pub fn call_a_bunch_of_trait_methods(trait_objects: &[&dyn Foo]) { - - // Same as above, just with vtables in between - for x in trait_objects { - x.foo(); - } -} diff --git a/src/test/run-make-fulldeps/pgo-indirect-call-promotion/main.rs b/src/test/run-make-fulldeps/pgo-indirect-call-promotion/main.rs deleted file mode 100644 index 27181f307..000000000 --- a/src/test/run-make-fulldeps/pgo-indirect-call-promotion/main.rs +++ /dev/null @@ -1,14 +0,0 @@ -extern crate interesting; - -fn main() { - // function pointer case - let fns: Vec<_> = std::iter::repeat(interesting::function_called_always as fn()) - .take(1000) - .collect(); - interesting::call_a_bunch_of_functions(&fns[..]); - - // Trait object case - let trait_objects = vec![0u32; 1000]; - let trait_objects: Vec<_> = trait_objects.iter().map(|x| x as &dyn interesting::Foo).collect(); - interesting::call_a_bunch_of_trait_methods(&trait_objects[..]); -} diff --git a/src/test/run-make-fulldeps/pgo-indirect-call-promotion/opaque.rs b/src/test/run-make-fulldeps/pgo-indirect-call-promotion/opaque.rs deleted file mode 100644 index 9628d711c..000000000 --- a/src/test/run-make-fulldeps/pgo-indirect-call-promotion/opaque.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![crate_name="opaque"] -#![crate_type="rlib"] - -#[no_mangle] -pub fn opaque_f1() {} -#[no_mangle] -pub fn opaque_f2() {} |