Make partition
more consistent.
Always put the `create_size_estimate` calls and `debug_dump` calls within a timed scopes. This makes the four main steps look more similar to each other.
This commit is contained in:
parent
57a7c8f577
commit
e414d25e94
1 changed files with 18 additions and 15 deletions
|
@ -155,14 +155,16 @@ where
|
||||||
// functions and statics defined in the local crate.
|
// functions and statics defined in the local crate.
|
||||||
let PlacedRootMonoItems { mut codegen_units, internalization_candidates, unique_inlined_stats } = {
|
let PlacedRootMonoItems { mut codegen_units, internalization_candidates, unique_inlined_stats } = {
|
||||||
let _prof_timer = tcx.prof.generic_activity("cgu_partitioning_place_roots");
|
let _prof_timer = tcx.prof.generic_activity("cgu_partitioning_place_roots");
|
||||||
place_root_mono_items(cx, mono_items)
|
let mut placed = place_root_mono_items(cx, mono_items);
|
||||||
};
|
|
||||||
|
|
||||||
for cgu in &mut codegen_units {
|
for cgu in &mut placed.codegen_units {
|
||||||
cgu.create_size_estimate(tcx);
|
cgu.create_size_estimate(tcx);
|
||||||
}
|
}
|
||||||
|
|
||||||
debug_dump(tcx, "ROOTS", &codegen_units, unique_inlined_stats);
|
debug_dump(tcx, "ROOTS", &placed.codegen_units, placed.unique_inlined_stats);
|
||||||
|
|
||||||
|
placed
|
||||||
|
};
|
||||||
|
|
||||||
// Merge until we have at most `max_cgu_count` codegen units.
|
// Merge until we have at most `max_cgu_count` codegen units.
|
||||||
// `merge_codegen_units` is responsible for updating the CGU size
|
// `merge_codegen_units` is responsible for updating the CGU size
|
||||||
|
@ -179,22 +181,25 @@ where
|
||||||
// local functions the definition of which is marked with `#[inline]`.
|
// local functions the definition of which is marked with `#[inline]`.
|
||||||
{
|
{
|
||||||
let _prof_timer = tcx.prof.generic_activity("cgu_partitioning_place_inline_items");
|
let _prof_timer = tcx.prof.generic_activity("cgu_partitioning_place_inline_items");
|
||||||
place_inlined_mono_items(cx, &mut codegen_units)
|
place_inlined_mono_items(cx, &mut codegen_units);
|
||||||
};
|
|
||||||
|
|
||||||
for cgu in &mut codegen_units {
|
for cgu in &mut codegen_units {
|
||||||
cgu.create_size_estimate(tcx);
|
cgu.create_size_estimate(tcx);
|
||||||
}
|
}
|
||||||
|
|
||||||
debug_dump(tcx, "INLINE", &codegen_units, unique_inlined_stats);
|
debug_dump(tcx, "INLINE", &codegen_units, unique_inlined_stats);
|
||||||
|
}
|
||||||
|
|
||||||
// Next we try to make as many symbols "internal" as possible, so LLVM has
|
// Next we try to make as many symbols "internal" as possible, so LLVM has
|
||||||
// more freedom to optimize.
|
// more freedom to optimize.
|
||||||
if !tcx.sess.link_dead_code() {
|
if !tcx.sess.link_dead_code() {
|
||||||
let _prof_timer = tcx.prof.generic_activity("cgu_partitioning_internalize_symbols");
|
let _prof_timer = tcx.prof.generic_activity("cgu_partitioning_internalize_symbols");
|
||||||
internalize_symbols(cx, &mut codegen_units, internalization_candidates);
|
internalize_symbols(cx, &mut codegen_units, internalization_candidates);
|
||||||
|
|
||||||
|
debug_dump(tcx, "INTERNALIZE", &codegen_units, unique_inlined_stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mark one CGU for dead code, if necessary.
|
||||||
let instrument_dead_code =
|
let instrument_dead_code =
|
||||||
tcx.sess.instrument_coverage() && !tcx.sess.instrument_coverage_except_unused_functions();
|
tcx.sess.instrument_coverage() && !tcx.sess.instrument_coverage_except_unused_functions();
|
||||||
if instrument_dead_code {
|
if instrument_dead_code {
|
||||||
|
@ -204,8 +209,6 @@ where
|
||||||
// Ensure CGUs are sorted by name, so that we get deterministic results.
|
// Ensure CGUs are sorted by name, so that we get deterministic results.
|
||||||
assert!(codegen_units.is_sorted_by(|a, b| Some(a.name().as_str().cmp(b.name().as_str()))));
|
assert!(codegen_units.is_sorted_by(|a, b| Some(a.name().as_str().cmp(b.name().as_str()))));
|
||||||
|
|
||||||
debug_dump(tcx, "FINAL", &codegen_units, unique_inlined_stats);
|
|
||||||
|
|
||||||
codegen_units
|
codegen_units
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue