Skip to content

Commit c5643b3

Browse files
committed
Auto merge of #65052 - ishitatsuyuki:no-inline-cgu, r=<try>
[perf] Disable inline_in_all_cgus when LTO is enabled I tried to run lolbench with this flag altered; however lolbench either errored or got stuck, so I end up running only 3 of the benchmarks manually. One showed no changes, another one showed 20% perf improvement somehow, and another showed slight (1%) regression. So I'm thinking of benchmarking it with perf instead; if we still have ThinLTO on CI then we can measure stage2 compiler performance as a metric of how much it affects generated code.
2 parents 9e35a28 + 3e0a02a commit c5643b3

File tree

2 files changed

+2
-206
lines changed

2 files changed

+2
-206
lines changed

src/librustc/mir/mono.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::dep_graph::{WorkProductId, DepNode, WorkProduct, DepConstructor};
1010
use rustc_data_structures::base_n;
1111
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
1212
use crate::ich::{Fingerprint, StableHashingContext, NodeIdHashingMode};
13-
use crate::session::config::OptLevel;
13+
use crate::session::config::{OptLevel, Lto};
1414
use std::fmt;
1515
use std::hash::Hash;
1616

@@ -89,7 +89,7 @@ impl<'tcx> MonoItem<'tcx> {
8989
pub fn instantiation_mode(&self, tcx: TyCtxt<'tcx>) -> InstantiationMode {
9090
let inline_in_all_cgus =
9191
tcx.sess.opts.debugging_opts.inline_in_all_cgus.unwrap_or_else(|| {
92-
tcx.sess.opts.optimize != OptLevel::No
92+
tcx.sess.opts.optimize != OptLevel::No && tcx.sess.lto() == Lto::No
9393
}) && !tcx.sess.opts.cg.link_dead_code;
9494

9595
match *self {

src/librustc_mir/monomorphize/item.rs

Lines changed: 0 additions & 204 deletions
This file was deleted.

0 commit comments

Comments
 (0)