about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-06-15 00:04:01 +0000
committerbors <bors@rust-lang.org>2024-06-15 00:04:01 +0000
commit3fc81daffd18aa1fc00a1d67cfaca12a32a07e46 (patch)
tree5f92b09d596845506470e36bcc30069612a1837e
parentf8e566053207b4ecbcbc7a7d6ded82c43061e3da (diff)
parent186d94dc6be108d7e507e4a5129375335149cd23 (diff)
downloadrust-3fc81daffd18aa1fc00a1d67cfaca12a32a07e46.tar.gz
rust-3fc81daffd18aa1fc00a1d67cfaca12a32a07e46.zip
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.
-rw-r--r--src/ci/github-actions/jobs.yml6
-rw-r--r--src/tools/compiletest/src/header.rs3
-rw-r--r--tests/codegen/instrument-coverage/instrument-coverage-off.rs1
-rw-r--r--tests/codegen/instrument-coverage/instrument-coverage.rs6
-rw-r--r--tests/codegen/instrument-coverage/testprog.rs2
-rw-r--r--tests/codegen/naked-fn/naked-nocoverage.rs2
-rw-r--r--tests/codegen/pgo-counter-bias.rs2
-rw-r--r--tests/codegen/pgo-instrumentation.rs2
-rw-r--r--tests/run-make/optimization-remarks-dir-pgo/Makefile4
-rw-r--r--tests/run-make/pgo-branch-weights/rmake.rs4
-rw-r--r--tests/run-make/pgo-gen-lto/Makefile4
-rw-r--r--tests/run-make/pgo-gen-no-imp-symbols/Makefile4
-rw-r--r--tests/run-make/pgo-gen/Makefile4
-rw-r--r--tests/run-make/pgo-indirect-call-promotion/Makefile4
-rw-r--r--tests/run-make/pgo-use/Makefile4
-rw-r--r--tests/run-make/track-pgo-dep-info/Makefile1
-rw-r--r--tests/ui/instrument-coverage/coverage-options.rs3
-rw-r--r--tests/ui/instrument-coverage/on-values.rs2
18 files changed, 12 insertions, 46 deletions
diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml
index 010e1b8fd51..4366a92fbcd 100644
--- a/src/ci/github-actions/jobs.yml
+++ b/src/ci/github-actions/jobs.yml
@@ -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
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index ffc706d19a9..5469b9f1a0a 100644
--- a/src/tools/compiletest/src/header.rs
+++ b/src/tools/compiletest/src/header.rs
@@ -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.
diff --git a/tests/codegen/instrument-coverage/instrument-coverage-off.rs b/tests/codegen/instrument-coverage/instrument-coverage-off.rs
index 616e3295e5b..e44d6c65874 100644
--- a/tests/codegen/instrument-coverage/instrument-coverage-off.rs
+++ b/tests/codegen/instrument-coverage/instrument-coverage-off.rs
@@ -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
diff --git a/tests/codegen/instrument-coverage/instrument-coverage.rs b/tests/codegen/instrument-coverage/instrument-coverage.rs
index 65fa437d250..23d23651c72 100644
--- a/tests/codegen/instrument-coverage/instrument-coverage.rs
+++ b/tests/codegen/instrument-coverage/instrument-coverage.rs
@@ -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"]
 
diff --git a/tests/codegen/instrument-coverage/testprog.rs b/tests/codegen/instrument-coverage/testprog.rs
index acc4f35d905..eea4d9cb3cf 100644
--- a/tests/codegen/instrument-coverage/testprog.rs
+++ b/tests/codegen/instrument-coverage/testprog.rs
@@ -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
 
diff --git a/tests/codegen/naked-fn/naked-nocoverage.rs b/tests/codegen/naked-fn/naked-nocoverage.rs
index e8d3b5834fa..d73c5b7fd26 100644
--- a/tests/codegen/naked-fn/naked-nocoverage.rs
+++ b/tests/codegen/naked-fn/naked-nocoverage.rs
@@ -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)]
diff --git a/tests/codegen/pgo-counter-bias.rs b/tests/codegen/pgo-counter-bias.rs
index 87d31073d5a..48e815dda04 100644
--- a/tests/codegen/pgo-counter-bias.rs
+++ b/tests/codegen/pgo-counter-bias.rs
@@ -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
diff --git a/tests/codegen/pgo-instrumentation.rs b/tests/codegen/pgo-instrumentation.rs
index b1906c145c6..a8f12ccce1c 100644
--- a/tests/codegen/pgo-instrumentation.rs
+++ b/tests/codegen/pgo-instrumentation.rs
@@ -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 =
diff --git a/tests/run-make/optimization-remarks-dir-pgo/Makefile b/tests/run-make/optimization-remarks-dir-pgo/Makefile
index 3bc3d7d1428..57ffd6e70f0 100644
--- a/tests/run-make/optimization-remarks-dir-pgo/Makefile
+++ b/tests/run-make/optimization-remarks-dir-pgo/Makefile
@@ -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
diff --git a/tests/run-make/pgo-branch-weights/rmake.rs b/tests/run-make/pgo-branch-weights/rmake.rs
index 55f6e7e56c5..d3cb79c39af 100644
--- a/tests/run-make/pgo-branch-weights/rmake.rs
+++ b/tests/run-make/pgo-branch-weights/rmake.rs
@@ -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;
 
diff --git a/tests/run-make/pgo-gen-lto/Makefile b/tests/run-make/pgo-gen-lto/Makefile
index 8b647846af3..54164c99522 100644
--- a/tests/run-make/pgo-gen-lto/Makefile
+++ b/tests/run-make/pgo-gen-lto/Makefile
@@ -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)"
diff --git a/tests/run-make/pgo-gen-no-imp-symbols/Makefile b/tests/run-make/pgo-gen-no-imp-symbols/Makefile
index 7f72b11b611..d2baa145ba5 100644
--- a/tests/run-make/pgo-gen-no-imp-symbols/Makefile
+++ b/tests/run-make/pgo-gen-no-imp-symbols/Makefile
@@ -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
diff --git a/tests/run-make/pgo-gen/Makefile b/tests/run-make/pgo-gen/Makefile
index bf32cfdb802..c1d456986fb 100644
--- a/tests/run-make/pgo-gen/Makefile
+++ b/tests/run-make/pgo-gen/Makefile
@@ -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)"
diff --git a/tests/run-make/pgo-indirect-call-promotion/Makefile b/tests/run-make/pgo-indirect-call-promotion/Makefile
index 542eb244d39..8d1e69c4aba 100644
--- a/tests/run-make/pgo-indirect-call-promotion/Makefile
+++ b/tests/run-make/pgo-indirect-call-promotion/Makefile
@@ -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:
diff --git a/tests/run-make/pgo-use/Makefile b/tests/run-make/pgo-use/Makefile
index 9f440118dae..92098a4019c 100644
--- a/tests/run-make/pgo-use/Makefile
+++ b/tests/run-make/pgo-use/Makefile
@@ -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
diff --git a/tests/run-make/track-pgo-dep-info/Makefile b/tests/run-make/track-pgo-dep-info/Makefile
index 6c7f67d0f0a..3afe3662fa7 100644
--- a/tests/run-make/track-pgo-dep-info/Makefile
+++ b/tests/run-make/track-pgo-dep-info/Makefile
@@ -1,5 +1,4 @@
 # needs-profiler-support
-# ignore-windows-gnu
 
 include ../tools.mk
 
diff --git a/tests/ui/instrument-coverage/coverage-options.rs b/tests/ui/instrument-coverage/coverage-options.rs
index 8f523a5fd11..7615a0fb275 100644
--- a/tests/ui/instrument-coverage/coverage-options.rs
+++ b/tests/ui/instrument-coverage/coverage-options.rs
@@ -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
diff --git a/tests/ui/instrument-coverage/on-values.rs b/tests/ui/instrument-coverage/on-values.rs
index a6793b2c304..53b149fd39c 100644
--- a/tests/ui/instrument-coverage/on-values.rs
+++ b/tests/ui/instrument-coverage/on-values.rs
@@ -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