diff options
| author | yukang <moorekang@gmail.com> | 2022-12-15 14:49:11 +0800 |
|---|---|---|
| committer | yukang <moorekang@gmail.com> | 2023-02-24 08:07:43 +0000 |
| commit | 34813e205157f0235e5cf8847079f13ac6acd078 (patch) | |
| tree | 6735e78b84c5da80fc19b1428d528a245fd3e628 | |
| parent | 07c993eba8b76eae497e98433ae075b00f01be10 (diff) | |
| download | rust-34813e205157f0235e5cf8847079f13ac6acd078.tar.gz rust-34813e205157f0235e5cf8847079f13ac6acd078.zip | |
Test that the compiler/library builds with -Zmir-opt-level=3 -Zvalidate-mir
| -rw-r--r-- | config.toml.example | 3 | ||||
| -rw-r--r-- | src/bootstrap/builder.rs | 7 | ||||
| -rw-r--r-- | src/bootstrap/config.rs | 3 | ||||
| -rwxr-xr-x | src/ci/run.sh | 1 |
4 files changed, 14 insertions, 0 deletions
diff --git a/config.toml.example b/config.toml.example index df4478bb0cb..69eb228a2d5 100644 --- a/config.toml.example +++ b/config.toml.example @@ -666,6 +666,9 @@ changelog-seen = 2 # LTO entirely. #lto = "thin-local" +# Build compiler with the optimization enabled and -Zvalidate-mir, currently only for `std` +#validate-mir-opts = 3 + # ============================================================================= # Options for specific targets # diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 952c70cec1c..fe92ee3c18e 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -1915,6 +1915,13 @@ impl<'a> Builder<'a> { } } + if matches!(mode, Mode::Std) { + if let Some(mir_opt_level) = self.config.rust_validate_mir_opts { + rustflags.arg("-Zvalidate-mir"); + rustflags.arg(&format!("-Zmir-opt-level={}", mir_opt_level)); + } + } + Cargo { command: cargo, rustflags, rustdocflags, allow_features } } diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 56f96734bbb..4a563bc396d 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -173,6 +173,7 @@ pub struct Config { pub rust_profile_use: Option<String>, pub rust_profile_generate: Option<String>, pub rust_lto: RustcLto, + pub rust_validate_mir_opts: Option<u32>, pub llvm_profile_use: Option<String>, pub llvm_profile_generate: bool, pub llvm_libunwind_default: Option<LlvmLibunwind>, @@ -770,6 +771,7 @@ define_config! { // ignored; this is set from an env var set by bootstrap.py download_rustc: Option<StringOrBool> = "download-rustc", lto: Option<String> = "lto", + validate_mir_opts: Option<u32> = "validate-mir-opts", } } @@ -1149,6 +1151,7 @@ impl Config { .as_deref() .map(|value| RustcLto::from_str(value).unwrap()) .unwrap_or_default(); + config.rust_validate_mir_opts = rust.validate_mir_opts; } else { config.rust_profile_use = flags.rust_profile_use; config.rust_profile_generate = flags.rust_profile_generate; diff --git a/src/ci/run.sh b/src/ci/run.sh index 93dccb54c4e..1f451fc479c 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -58,6 +58,7 @@ RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-manage-submodules" RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-locked-deps" RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-cargo-native-static" RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set rust.codegen-units-std=1" +RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set rust.validate-mir-opts=3" # Only produce xz tarballs on CI. gz tarballs will be generated by the release # process by recompressing the existing xz ones. This decreases the storage |
