Use -Zno-profiler-runtime instead of //@ needs-profiler-support

For PGO/coverage tests that don't need to build or run an actual artifact, we
can use `-Zno-profiler-runtime` to run the test even when the profiler runtime
is not available.
This commit is contained in:
Zalathar 2024-03-16 17:02:30 +11:00
parent 0ef0dd2451
commit 5330ccdb34
9 changed files with 11 additions and 13 deletions

View file

@ -1,5 +1,6 @@
// Test that `-Cinstrument-coverage=off` does not add coverage instrumentation to LLVM IR.
//@ compile-flags: -Zno-profiler-runtime
//@ revisions: n no off false_ zero
//@ [n] compile-flags: -Cinstrument-coverage=n
//@ [no] compile-flags: -Cinstrument-coverage=no

View file

@ -1,6 +1,6 @@
// Test that `-Cinstrument-coverage` creates expected __llvm_profile_filename symbol in LLVM IR.
//@ needs-profiler-support
//@ compile-flags: -Zno-profiler-runtime
//@ revisions: default y yes on true_ all
//@ [default] compile-flags: -Cinstrument-coverage
//@ [y] compile-flags: -Cinstrument-coverage=y
@ -9,8 +9,8 @@
//@ [true_] compile-flags: -Cinstrument-coverage=true
//@ [all] compile-flags: -Cinstrument-coverage=all
// CHECK: @__llvm_profile_filename = {{.*}}"default_%m_%p.profraw\00"{{.*}}
// CHECK: @__llvm_coverage_mapping
// CHECK-DAG: @__llvm_coverage_mapping
// CHECK-DAG: @__llvm_profile_filename = {{.*}}"default_%m_%p.profraw\00"{{.*}}
#![crate_type = "lib"]

View file

@ -1,5 +1,5 @@
//@ edition: 2021
//@ needs-profiler-support
//@ compile-flags: -Zno-profiler-runtime
//@ compile-flags: -Cinstrument-coverage -Copt-level=0
//@ revisions: LINUX DARWIN WINDOWS

View file

@ -2,7 +2,7 @@
// Regression test for issue #105170.
//
//@ needs-asm-support
//@ needs-profiler-support
//@ compile-flags: -Zno-profiler-runtime
//@ compile-flags: -Cinstrument-coverage
#![crate_type = "lib"]
#![feature(naked_functions)]

View file

@ -2,7 +2,7 @@
//@ ignore-apple -runtime-counter-relocation not honored on Mach-O
//@ compile-flags: -Cprofile-generate -Cllvm-args=-runtime-counter-relocation -Clto=fat
//@ needs-profiler-support
//@ compile-flags: -Zno-profiler-runtime
//@ no-prefer-dynamic
// CHECK: @__llvm_profile_counter_bias = {{.*}}global

View file

@ -1,6 +1,6 @@
// Test that `-Cprofile-generate` creates expected instrumentation artifacts in LLVM IR.
//@ needs-profiler-support
//@ compile-flags: -Zno-profiler-runtime
//@ compile-flags: -Cprofile-generate -Ccodegen-units=1
// CHECK: @__llvm_profile_raw_version =

View file

@ -1,8 +1,6 @@
# needs-profiler-support
include ../tools.mk
COMPILE_FLAGS=-O -Ccodegen-units=1 -Cprofile-generate="$(TMPDIR)"
COMPILE_FLAGS=-O -Ccodegen-units=1 -Cprofile-generate="$(TMPDIR)" -Zno-profiler-runtime
all:
$(RUSTC) $(COMPILE_FLAGS) --emit=llvm-ir test.rs

View file

@ -1,6 +1,5 @@
//@ needs-profiler-support
//@ revisions: block branch condition mcdc bad
//@ compile-flags -Cinstrument-coverage
//@ compile-flags -Cinstrument-coverage -Zno-profiler-runtime
//@ [block] check-pass
//@ [block] compile-flags: -Zcoverage-options=block

View file

@ -1,5 +1,5 @@
//@ check-pass
//@ needs-profiler-support
//@ compile-flags: -Zno-profiler-runtime
//@ revisions: default y yes on true_ all
//@ [default] compile-flags: -Cinstrument-coverage
//@ [y] compile-flags: -Cinstrument-coverage=y