Skip to content

Commit 3fc81da

Browse files
committedJun 15, 2024
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.
2 parents f8e5660 + 186d94d commit 3fc81da

File tree

18 files changed

+12
-46
lines changed

18 files changed

+12
-46
lines changed
 

‎src/ci/github-actions/jobs.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,7 @@ auto:
390390
- image: x86_64-mingw
391391
env:
392392
SCRIPT: make ci-mingw
393-
RUST_CONFIGURE_ARGS: >-
394-
--build=x86_64-pc-windows-gnu
395-
--enable-profiler
393+
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
396394
# We are intentionally allowing an old toolchain on this builder (and that's
397395
# incompatible with LLVM downloads today).
398396
NO_DOWNLOAD_CI_LLVM: 1
@@ -440,7 +438,6 @@ auto:
440438
RUST_CONFIGURE_ARGS: >-
441439
--build=i686-pc-windows-gnu
442440
--enable-full-tools
443-
--enable-profiler
444441
# We are intentionally allowing an old toolchain on this builder (and that's
445442
# incompatible with LLVM downloads today).
446443
NO_DOWNLOAD_CI_LLVM: 1
@@ -454,7 +451,6 @@ auto:
454451
RUST_CONFIGURE_ARGS: >-
455452
--build=x86_64-pc-windows-gnu
456453
--enable-full-tools
457-
--enable-profiler
458454
# We are intentionally allowing an old toolchain on this builder (and that's
459455
# incompatible with LLVM downloads today).
460456
NO_DOWNLOAD_CI_LLVM: 1

‎src/tools/compiletest/src/header.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1023,9 +1023,6 @@ fn iter_header(
10231023
if mode == Mode::CoverageRun {
10241024
let extra_directives: &[&str] = &[
10251025
"needs-profiler-support",
1026-
// FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works
1027-
// properly. Since we only have GCC on the CI ignore the test for now.
1028-
"ignore-windows-gnu",
10291026
// FIXME(pietroalbini): this test currently does not work on cross-compiled
10301027
// targets because remote-test is not capable of sending back the *.profraw
10311028
// files generated by the LLVM instrumentation.

‎tests/codegen/instrument-coverage/instrument-coverage-off.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Test that `-Cinstrument-coverage=off` does not add coverage instrumentation to LLVM IR.
22

3+
//@ compile-flags: -Zno-profiler-runtime
34
//@ revisions: n no off false_ zero
45
//@ [n] compile-flags: -Cinstrument-coverage=n
56
//@ [no] compile-flags: -Cinstrument-coverage=no

‎tests/codegen/instrument-coverage/instrument-coverage.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Test that `-Cinstrument-coverage` creates expected __llvm_profile_filename symbol in LLVM IR.
22

3-
//@ needs-profiler-support
3+
//@ compile-flags: -Zno-profiler-runtime
44
//@ revisions: default y yes on true_ all
55
//@ [default] compile-flags: -Cinstrument-coverage
66
//@ [y] compile-flags: -Cinstrument-coverage=y
@@ -9,8 +9,8 @@
99
//@ [true_] compile-flags: -Cinstrument-coverage=true
1010
//@ [all] compile-flags: -Cinstrument-coverage=all
1111

12-
// CHECK: @__llvm_profile_filename = {{.*}}"default_%m_%p.profraw\00"{{.*}}
13-
// CHECK: @__llvm_coverage_mapping
12+
// CHECK-DAG: @__llvm_coverage_mapping
13+
// CHECK-DAG: @__llvm_profile_filename = {{.*}}"default_%m_%p.profraw\00"{{.*}}
1414

1515
#![crate_type = "lib"]
1616

‎tests/codegen/instrument-coverage/testprog.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ edition: 2021
2-
//@ needs-profiler-support
2+
//@ compile-flags: -Zno-profiler-runtime
33
//@ compile-flags: -Cinstrument-coverage -Copt-level=0
44
//@ revisions: LINUX DARWIN WINDOWS
55

‎tests/codegen/naked-fn/naked-nocoverage.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Regression test for issue #105170.
33
//
44
//@ needs-asm-support
5-
//@ needs-profiler-support
5+
//@ compile-flags: -Zno-profiler-runtime
66
//@ compile-flags: -Cinstrument-coverage
77
#![crate_type = "lib"]
88
#![feature(naked_functions)]

‎tests/codegen/pgo-counter-bias.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
//@ ignore-apple -runtime-counter-relocation not honored on Mach-O
44
//@ compile-flags: -Cprofile-generate -Cllvm-args=-runtime-counter-relocation -Clto=fat
5-
//@ needs-profiler-support
5+
//@ compile-flags: -Zno-profiler-runtime
66
//@ no-prefer-dynamic
77

88
// CHECK: @__llvm_profile_counter_bias = {{.*}}global

‎tests/codegen/pgo-instrumentation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Test that `-Cprofile-generate` creates expected instrumentation artifacts in LLVM IR.
22

3-
//@ needs-profiler-support
3+
//@ compile-flags: -Zno-profiler-runtime
44
//@ compile-flags: -Cprofile-generate -Ccodegen-units=1
55

66
// CHECK: @__llvm_profile_raw_version =

‎tests/run-make/optimization-remarks-dir-pgo/Makefile

-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# needs-profiler-support
2-
# ignore-windows-gnu
32
# ignore-cross-compile
43

5-
# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works
6-
# properly. Since we only have GCC on the CI ignore the test for now.
7-
84
include ../tools.mk
95

106
PROFILE_DIR=$(TMPDIR)/profiles

‎tests/run-make/pgo-branch-weights/rmake.rs

-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
//@ needs-profiler-support
1111
//@ ignore-cross-compile
1212

13-
// FIXME(Oneirical): This test has problems generating profdata on mingw.
14-
// For more information, see https://github.com/rust-lang/rust/pull/122613
15-
//@ ignore-windows-gnu
16-
1713
use run_make_support::{fs_wrapper, llvm_filecheck, llvm_profdata, run_with_args, rustc};
1814
use std::path::Path;
1915

‎tests/run-make/pgo-gen-lto/Makefile

-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# needs-profiler-support
2-
# ignore-windows-gnu
32
# ignore-cross-compile
43

5-
# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works
6-
# properly. Since we only have GCC on the CI ignore the test for now.
7-
84
include ../tools.mk
95

106
COMPILE_FLAGS=-Copt-level=3 -Clto=fat -Cprofile-generate="$(TMPDIR)"

‎tests/run-make/pgo-gen-no-imp-symbols/Makefile

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# needs-profiler-support
2-
31
include ../tools.mk
42

5-
COMPILE_FLAGS=-O -Ccodegen-units=1 -Cprofile-generate="$(TMPDIR)"
3+
COMPILE_FLAGS=-O -Ccodegen-units=1 -Cprofile-generate="$(TMPDIR)" -Zno-profiler-runtime
64

75
all:
86
$(RUSTC) $(COMPILE_FLAGS) --emit=llvm-ir test.rs

‎tests/run-make/pgo-gen/Makefile

-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# needs-profiler-support
2-
# ignore-windows-gnu
32
# ignore-cross-compile
43

5-
# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works
6-
# properly. Since we only have GCC on the CI ignore the test for now.
7-
84
include ../tools.mk
95

106
COMPILE_FLAGS=-g -Cprofile-generate="$(TMPDIR)"

‎tests/run-make/pgo-indirect-call-promotion/Makefile

-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# needs-profiler-support
2-
# ignore-windows-gnu
32
# ignore-cross-compile
43

5-
# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works
6-
# properly. Since we only have GCC on the CI ignore the test for now.
7-
84
include ../tools.mk
95

106
all:

‎tests/run-make/pgo-use/Makefile

-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# needs-profiler-support
2-
# ignore-windows-gnu
32
# ignore-cross-compile
43

5-
# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works
6-
# properly. Since we only have GCC on the CI ignore the test for now.
7-
84
include ../tools.mk
95

106
# This test makes sure that PGO profiling data leads to cold functions being

‎tests/run-make/track-pgo-dep-info/Makefile

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# needs-profiler-support
2-
# ignore-windows-gnu
32

43
include ../tools.mk
54

‎tests/ui/instrument-coverage/coverage-options.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
//@ needs-profiler-support
21
//@ revisions: block branch condition mcdc bad
3-
//@ compile-flags -Cinstrument-coverage
2+
//@ compile-flags -Cinstrument-coverage -Zno-profiler-runtime
43

54
//@ [block] check-pass
65
//@ [block] compile-flags: -Zcoverage-options=block

‎tests/ui/instrument-coverage/on-values.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ check-pass
2-
//@ needs-profiler-support
2+
//@ compile-flags: -Zno-profiler-runtime
33
//@ revisions: default y yes on true_ all
44
//@ [default] compile-flags: -Cinstrument-coverage
55
//@ [y] compile-flags: -Cinstrument-coverage=y

0 commit comments

Comments
 (0)
Please sign in to comment.