diff options
Diffstat (limited to 'src/test/run-make-fulldeps/pgo-branch-weights')
5 files changed, 0 insertions, 121 deletions
diff --git a/src/test/run-make-fulldeps/pgo-branch-weights/Makefile b/src/test/run-make-fulldeps/pgo-branch-weights/Makefile deleted file mode 100644 index c60206a1f..000000000 --- a/src/test/run-make-fulldeps/pgo-branch-weights/Makefile +++ /dev/null @@ -1,34 +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 - -# For some very small programs GNU ld seems to not properly handle -# instrumentation sections correctly. Neither Gold nor LLD have that problem. -ifeq ($(UNAME),Linux) -ifneq (,$(findstring x86,$(TARGET))) -COMMON_FLAGS=-Clink-args=-fuse-ld=gold -endif -endif - - -all: - # We don't compile `opaque` with either optimizations or instrumentation. - $(RUSTC) $(COMMON_FLAGS) opaque.rs || exit 1 - # Compile the test program with instrumentation - mkdir -p "$(TMPDIR)/prof_data_dir" || exit 1 - $(RUSTC) $(COMMON_FLAGS) interesting.rs \ - -Cprofile-generate="$(TMPDIR)/prof_data_dir" -O -Ccodegen-units=1 || exit 1 - $(RUSTC) $(COMMON_FLAGS) main.rs -Cprofile-generate="$(TMPDIR)/prof_data_dir" -O || exit 1 - # The argument below generates to the expected branch weights - $(call RUN,main aaaaaaaaaaaa2bbbbbbbbbbbb2bbbbbbbbbbbbbbbbcc) || exit 1 - "$(LLVM_BIN_DIR)/llvm-profdata" merge \ - -o "$(TMPDIR)/prof_data_dir/merged.profdata" \ - "$(TMPDIR)/prof_data_dir" || exit 1 - $(RUSTC) $(COMMON_FLAGS) interesting.rs \ - -Cprofile-use="$(TMPDIR)/prof_data_dir/merged.profdata" -O \ - -Ccodegen-units=1 --emit=llvm-ir || exit 1 - cat "$(TMPDIR)/interesting.ll" | "$(LLVM_FILECHECK)" filecheck-patterns.txt diff --git a/src/test/run-make-fulldeps/pgo-branch-weights/filecheck-patterns.txt b/src/test/run-make-fulldeps/pgo-branch-weights/filecheck-patterns.txt deleted file mode 100644 index 70d5a645c..000000000 --- a/src/test/run-make-fulldeps/pgo-branch-weights/filecheck-patterns.txt +++ /dev/null @@ -1,24 +0,0 @@ - -# First, establish that certain !prof labels are attached to the expected -# functions and branching instructions. - -CHECK: define void @function_called_twice(i32 {{.*}} !prof [[function_called_twice_id:![0-9]+]] { -CHECK: br i1 {{.*}}, label {{.*}}, label {{.*}}, !prof [[branch_weights0:![0-9]+]] - -CHECK: define void @function_called_42_times(i32{{.*}} %c) {{.*}} !prof [[function_called_42_times_id:![0-9]+]] { -CHECK: switch i32 %c, label {{.*}} [ -CHECK-NEXT: i32 97, label {{.*}} -CHECK-NEXT: i32 98, label {{.*}} -CHECK-NEXT: ], !prof [[branch_weights1:![0-9]+]] - -CHECK: define void @function_called_never(i32 {{.*}} !prof [[function_called_never_id:![0-9]+]] { - - - -# Now check that those !prof tags hold the expected counts - -CHECK: [[function_called_twice_id]] = !{!"function_entry_count", i64 2} -CHECK: [[branch_weights0]] = !{!"branch_weights", i32 2, i32 0} -CHECK: [[function_called_42_times_id]] = !{!"function_entry_count", i64 42} -CHECK: [[branch_weights1]] = !{!"branch_weights", i32 2, i32 12, i32 28} -CHECK: [[function_called_never_id]] = !{!"function_entry_count", i64 0} diff --git a/src/test/run-make-fulldeps/pgo-branch-weights/interesting.rs b/src/test/run-make-fulldeps/pgo-branch-weights/interesting.rs deleted file mode 100644 index a26d6fd69..000000000 --- a/src/test/run-make-fulldeps/pgo-branch-weights/interesting.rs +++ /dev/null @@ -1,40 +0,0 @@ -#![crate_name="interesting"] -#![crate_type="rlib"] - -extern crate opaque; - -#[no_mangle] -#[inline(never)] -pub fn function_called_twice(c: char) { - if c == '2' { - // This branch is taken twice - opaque::f1(); - } else { - // This branch is never taken - opaque::f2(); - } -} - -#[no_mangle] -#[inline(never)] -pub fn function_called_42_times(c: char) { - if c == 'a' { - // This branch is taken 12 times - opaque::f1(); - } else { - - if c == 'b' { - // This branch is taken 28 times - opaque::f2(); - } else { - // This branch is taken 2 times - opaque::f3(); - } - } -} - -#[no_mangle] -#[inline(never)] -pub fn function_called_never(_: char) { - opaque::f1(); -} diff --git a/src/test/run-make-fulldeps/pgo-branch-weights/main.rs b/src/test/run-make-fulldeps/pgo-branch-weights/main.rs deleted file mode 100644 index 619cf9c69..000000000 --- a/src/test/run-make-fulldeps/pgo-branch-weights/main.rs +++ /dev/null @@ -1,17 +0,0 @@ -extern crate interesting; - -fn main() { - let arg = std::env::args().skip(1).next().unwrap(); - - for c in arg.chars() { - if c == '2' { - interesting::function_called_twice(c); - } else { - interesting::function_called_42_times(c); - } - - if c == '0' { - interesting::function_called_never(c); - } - } -} diff --git a/src/test/run-make-fulldeps/pgo-branch-weights/opaque.rs b/src/test/run-make-fulldeps/pgo-branch-weights/opaque.rs deleted file mode 100644 index 72f93c9fe..000000000 --- a/src/test/run-make-fulldeps/pgo-branch-weights/opaque.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_name="opaque"] -#![crate_type="rlib"] - -pub fn f1() {} -pub fn f2() {} -pub fn f3() {} |