Skip to content

Commit

Permalink
Rollup merge of rust-lang#122613 - Zalathar:profiler, r=nnethercote
Browse files Browse the repository at this point in the history
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

rust-lang#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.
  • Loading branch information
matthiaskrgr committed Jun 13, 2024
2 parents 32b7592 + beb45a4 commit 7a1deaf
Show file tree
Hide file tree
Showing 18 changed files with 10 additions and 44 deletions.
6 changes: 1 addition & 5 deletions src/ci/github-actions/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 0 additions & 3 deletions src/tools/compiletest/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/codegen/instrument-coverage/instrument-coverage.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/codegen/instrument-coverage/testprog.rs
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/codegen/naked-fn/naked-nocoverage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion tests/codegen/pgo-counter-bias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/codegen/pgo-instrumentation.rs
Original file line number Diff line number Diff line change
@@ -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 =
Expand Down
4 changes: 0 additions & 4 deletions tests/run-make/optimization-remarks-dir-pgo/Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 0 additions & 4 deletions tests/run-make/pgo-branch-weights/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 0 additions & 4 deletions tests/run-make/pgo-gen-lto/Makefile
Original file line number Diff line number Diff line change
@@ -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)"
Expand Down
4 changes: 1 addition & 3 deletions tests/run-make/pgo-gen-no-imp-symbols/Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 0 additions & 4 deletions tests/run-make/pgo-gen/Makefile
Original file line number Diff line number Diff line change
@@ -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)"
Expand Down
4 changes: 0 additions & 4 deletions tests/run-make/pgo-indirect-call-promotion/Makefile
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
4 changes: 0 additions & 4 deletions tests/run-make/pgo-use/Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion tests/run-make/track-pgo-dep-info/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# needs-profiler-support
# ignore-windows-gnu

include ../tools.mk

Expand Down
3 changes: 1 addition & 2 deletions tests/ui/instrument-coverage/coverage-options.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/instrument-coverage/on-values.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 7a1deaf

Please sign in to comment.