Auto merge of #122613 - Zalathar:profiler, r=nnethercote

Don't build a broken/untested profiler runtime on mingw targets

Context: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Why.20build.20a.20broken.2Funtested.20profiler.20runtime.20on.20mingw.3F

#75872 added `--enable-profiler` to the `x86_64-mingw` job (to cause some additional tests to run), but had to also add `//@ ignore-windows-gnu` to all of the tests that rely on the profiler runtime actually *working*, because it's broken on that target.

We can achieve a similar outcome by going through all the `//@ needs-profiler-support` tests that don't actually need to produce/run a binary, and making them use `-Zno-profiler-runtime` instead, so that they can run even in configurations that don't have the profiler runtime available. Then we can remove `--enable-profiler` from `x86_64-mingw`, and still get the same amount of testing.

This PR also removes `--enable-profiler` from the mingw dist builds, since it is broken/untested on that target. Those builds have had that flag for a very long time.
This commit is contained in:
bors 2024-06-15 00:04:01 +00:00
commit 3fc81daffd
18 changed files with 12 additions and 46 deletions

View file

@ -390,9 +390,7 @@ auto:
- image: x86_64-mingw
env:
SCRIPT: make ci-mingw
RUST_CONFIGURE_ARGS: >-
--build=x86_64-pc-windows-gnu
--enable-profiler
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
# We are intentionally allowing an old toolchain on this builder (and that's
# incompatible with LLVM downloads today).
NO_DOWNLOAD_CI_LLVM: 1
@ -440,7 +438,6 @@ auto:
RUST_CONFIGURE_ARGS: >-
--build=i686-pc-windows-gnu
--enable-full-tools
--enable-profiler
# We are intentionally allowing an old toolchain on this builder (and that's
# incompatible with LLVM downloads today).
NO_DOWNLOAD_CI_LLVM: 1
@ -454,7 +451,6 @@ auto:
RUST_CONFIGURE_ARGS: >-
--build=x86_64-pc-windows-gnu
--enable-full-tools
--enable-profiler
# We are intentionally allowing an old toolchain on this builder (and that's
# incompatible with LLVM downloads today).
NO_DOWNLOAD_CI_LLVM: 1

View file

@ -1023,9 +1023,6 @@ fn iter_header(
if mode == Mode::CoverageRun {
let extra_directives: &[&str] = &[
"needs-profiler-support",
// 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.
"ignore-windows-gnu",
// FIXME(pietroalbini): this test currently does not work on cross-compiled
// targets because remote-test is not capable of sending back the *.profraw
// files generated by the LLVM instrumentation.

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,10 +1,6 @@
# needs-profiler-support
# ignore-windows-gnu
# ignore-cross-compile
# 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
PROFILE_DIR=$(TMPDIR)/profiles

View file

@ -10,10 +10,6 @@
//@ needs-profiler-support
//@ ignore-cross-compile
// FIXME(Oneirical): This test has problems generating profdata on mingw.
// For more information, see https://github.com/rust-lang/rust/pull/122613
//@ ignore-windows-gnu
use run_make_support::{fs_wrapper, llvm_filecheck, llvm_profdata, run_with_args, rustc};
use std::path::Path;

View file

@ -1,10 +1,6 @@
# needs-profiler-support
# ignore-windows-gnu
# ignore-cross-compile
# 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
COMPILE_FLAGS=-Copt-level=3 -Clto=fat -Cprofile-generate="$(TMPDIR)"

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,10 +1,6 @@
# needs-profiler-support
# ignore-windows-gnu
# ignore-cross-compile
# 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
COMPILE_FLAGS=-g -Cprofile-generate="$(TMPDIR)"

View file

@ -1,10 +1,6 @@
# needs-profiler-support
# ignore-windows-gnu
# ignore-cross-compile
# 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:

View file

@ -1,10 +1,6 @@
# needs-profiler-support
# ignore-windows-gnu
# ignore-cross-compile
# 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
# This test makes sure that PGO profiling data leads to cold functions being

View file

@ -1,5 +1,4 @@
# needs-profiler-support
# ignore-windows-gnu
include ../tools.mk

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