Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions compiler/rustc_middle/src/mir/mono.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,7 @@ impl<'tcx> MonoItem<'tcx> {
return InstantiationMode::LocalCopy;
}

// Finally, if this is `#[inline(always)]` we're sure to respect
// that with an inline copy per CGU, but otherwise we'll be
// creating one copy of this `#[inline]` function which may
// conflict with upstream crates as it could be an exported
// symbol.
if tcx.codegen_fn_attrs(instance.def_id()).inline.always() {
InstantiationMode::LocalCopy
} else {
InstantiationMode::GloballyShared { may_conflict: true }
}
InstantiationMode::GloballyShared { may_conflict: true }
}
MonoItem::Static(..) | MonoItem::GlobalAsm(..) => {
InstantiationMode::GloballyShared { may_conflict: false }
Expand Down
11 changes: 9 additions & 2 deletions compiler/rustc_monomorphize/src/partitioning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,14 @@ fn compute_codegen_unit_name(
let mut cgu_def_id = None;
// Walk backwards from the item we want to find the module for.
loop {
if tcx.sess.opts.incremental.is_some()
&& tcx.sess.opts.optimize == rustc_session::config::OptLevel::No
&& def_id.is_local()
{
cgu_def_id = Some(current_def_id);
break;
}

if current_def_id.is_crate_root() {
if cgu_def_id.is_none() {
// If we have not found a module yet, take the crate root.
Expand All @@ -716,8 +724,7 @@ fn compute_codegen_unit_name(
let def_path = tcx.def_path(cgu_def_id);

let components = def_path.data.iter().map(|part| match part.data.name() {
DefPathDataName::Named(name) => name,
DefPathDataName::Anon { .. } => unreachable!(),
DefPathDataName::Named(name) | DefPathDataName::Anon { namespace: name } => name,
});

let volatile_suffix = volatile.then_some("volatile");
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_session/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ impl Session {
// codegen units in order to reduce the "collateral damage" small
// changes cause.
if self.opts.incremental.is_some() {
return CodegenUnits::Default(256);
return CodegenUnits::Default(4096);
}

// Why is 16 codegen units the default all the time?
Expand Down
Loading