File tree Expand file tree Collapse file tree 4 files changed +14
-0
lines changed Expand file tree Collapse file tree 4 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -649,6 +649,9 @@ changelog-seen = 2
649649# "thin" or "fat" to apply Thin/Fat LTO to the `rustc_driver` dylib.
650650# lto = "thin-local"
651651
652+ # Build compiler with the optimization enabled and -Zvalidate-mir, currently only for `std`
653+ # validate-mir-opts = 3
654+
652655# =============================================================================
653656# Options for specific targets
654657#
Original file line number Diff line number Diff line change @@ -1871,6 +1871,13 @@ impl<'a> Builder<'a> {
18711871 }
18721872 }
18731873
1874+ if matches ! ( mode, Mode :: Std ) {
1875+ if let Some ( mir_opt_level) = self . config . rust_validate_mir_opts {
1876+ rustflags. arg ( "-Zvalidate-mir" ) ;
1877+ rustflags. arg ( & format ! ( "-Zmir-opt-level={}" , mir_opt_level) ) ;
1878+ }
1879+ }
1880+
18741881 Cargo { command : cargo, rustflags, rustdocflags }
18751882 }
18761883
Original file line number Diff line number Diff line change @@ -168,6 +168,7 @@ pub struct Config {
168168 pub rust_profile_use : Option < String > ,
169169 pub rust_profile_generate : Option < String > ,
170170 pub rust_lto : RustcLto ,
171+ pub rust_validate_mir_opts : Option < u32 > ,
171172 pub llvm_profile_use : Option < String > ,
172173 pub llvm_profile_generate : bool ,
173174 pub llvm_libunwind_default : Option < LlvmLibunwind > ,
@@ -762,6 +763,7 @@ define_config! {
762763 // ignored; this is set from an env var set by bootstrap.py
763764 download_rustc: Option <StringOrBool > = "download-rustc" ,
764765 lto: Option <String > = "lto" ,
766+ validate_mir_opts: Option <u32 > = "validate-mir-opts" ,
765767 }
766768}
767769
@@ -1136,6 +1138,7 @@ impl Config {
11361138 . as_deref ( )
11371139 . map ( |value| RustcLto :: from_str ( value) . unwrap ( ) )
11381140 . unwrap_or_default ( ) ;
1141+ config. rust_validate_mir_opts = rust. validate_mir_opts ;
11391142 } else {
11401143 config. rust_profile_use = flags. rust_profile_use ;
11411144 config. rust_profile_generate = flags. rust_profile_generate ;
Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-manage-submodules"
6464RUST_CONFIGURE_ARGS=" $RUST_CONFIGURE_ARGS --enable-locked-deps"
6565RUST_CONFIGURE_ARGS=" $RUST_CONFIGURE_ARGS --enable-cargo-native-static"
6666RUST_CONFIGURE_ARGS=" $RUST_CONFIGURE_ARGS --set rust.codegen-units-std=1"
67+ RUST_CONFIGURE_ARGS=" $RUST_CONFIGURE_ARGS --set rust.validate-mir-opts=3"
6768
6869# Only produce xz tarballs on CI. gz tarballs will be generated by the release
6970# process by recompressing the existing xz ones. This decreases the storage
You can’t perform that action at this time.
0 commit comments