From 0b3060138b753b5e1b60d561f913d60acef8636b Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Mon, 19 Jun 2023 17:21:30 +0000 Subject: [PATCH] Use -Zinline-mir instead of -Zmir-opt-level=3 Except for mir inlining all mir opts that are beneficial for cg_clif now run on -Zmir-opt-level=2. -Zmir-opt-level=3 enables some more expensive optimizations. --- build_system/build_sysroot.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build_system/build_sysroot.rs b/build_system/build_sysroot.rs index 74bba9ed5eb..2c8da62fb05 100644 --- a/build_system/build_sysroot.rs +++ b/build_system/build_sysroot.rs @@ -251,7 +251,10 @@ fn build_clif_sysroot_for_triple( rustflags .push_str(&format!(" --sysroot {}", RTSTARTUP_SYSROOT.to_path(dirs).to_str().unwrap())); if channel == "release" { - rustflags.push_str(" -Zmir-opt-level=3"); + // Incremental compilation by default disables mir inlining. This leads to both a decent + // compile perf and a significant runtime perf regression. As such forcefully enable mir + // inlining. + rustflags.push_str(" -Zinline-mir"); } compiler.rustflags += &rustflags; let mut build_cmd = STANDARD_LIBRARY.build(&compiler, dirs);