diff --git a/compiler/rustc_middle/src/mir/mono.rs b/compiler/rustc_middle/src/mir/mono.rs index ca735d5231465..ed9f1fa1a8c4f 100644 --- a/compiler/rustc_middle/src/mir/mono.rs +++ b/compiler/rustc_middle/src/mir/mono.rs @@ -61,7 +61,7 @@ impl<'tcx> MonoItem<'tcx> { MonoItem::Fn(instance) => { // Estimate the size of a function based on how many statements // it contains. - tcx.instance_def_size_estimate(instance.def) + 1 + tcx.instance_def_size_estimate(instance.def) } // Conservatively estimate the size of a static declaration // or assembly to be 1. diff --git a/compiler/rustc_monomorphize/src/partitioning.rs b/compiler/rustc_monomorphize/src/partitioning.rs index 97e3748b8b826..570fd9fb56771 100644 --- a/compiler/rustc_monomorphize/src/partitioning.rs +++ b/compiler/rustc_monomorphize/src/partitioning.rs @@ -322,9 +322,9 @@ fn merge_codegen_units<'tcx>( // Having multiple CGUs can drastically speed up compilation. But for // non-incremental builds, tiny CGUs slow down compilation *and* result in // worse generated code. So we don't allow CGUs smaller than this (unless - // there is just one CGU, of course). Note that CGU sizes of 100,000+ are + // there is just one CGU, of course). Note that CGU sizes of 20,000+ are // common in larger programs, so this isn't all that large. - const NON_INCR_MIN_CGU_SIZE: usize = 1800; + const NON_INCR_MIN_CGU_SIZE: usize = 500; // Repeatedly merge the two smallest codegen units as long as: // - we have more CGUs than the upper limit, or diff --git a/compiler/rustc_ty_utils/src/ty.rs b/compiler/rustc_ty_utils/src/ty.rs index fe2d1fba7fe6e..89cadf6665075 100644 --- a/compiler/rustc_ty_utils/src/ty.rs +++ b/compiler/rustc_ty_utils/src/ty.rs @@ -459,7 +459,7 @@ fn instance_def_size_estimate<'tcx>( match instance_def { InstanceDef::Item(..) | InstanceDef::DropGlue(..) => { let mir = tcx.instance_mir(instance_def); - mir.basic_blocks.iter().map(|bb| bb.statements.len() + 1).sum() + mir.basic_blocks.len() } // Estimate the size of other compiler-generated shims to be 1. _ => 1,