1
Fork 0

Auto merge of #113777 - nnethercote:overlap-based-cgu-merging, r=pnkfelix

Inline overlap based CGU merging

Introduce a new CGU merging algorithm that aims to minimize the number of duplicated inlined items.

r? `@wesleywiser`
This commit is contained in:
bors 2023-07-18 22:36:17 +00:00
commit 0d6a9b2bf7
2 changed files with 103 additions and 37 deletions

View file

@ -56,6 +56,8 @@ impl<'tcx> MonoItem<'tcx> {
}
}
// Note: if you change how item size estimates work, you might need to
// change NON_INCR_MIN_CGU_SIZE as well.
pub fn size_estimate(&self, tcx: TyCtxt<'tcx>) -> usize {
match *self {
MonoItem::Fn(instance) => {
@ -248,8 +250,14 @@ pub struct CodegenUnit<'tcx> {
/// Auxiliary info about a `MonoItem`.
#[derive(Copy, Clone, PartialEq, Debug, HashStable)]
pub struct MonoItemData {
/// A cached copy of the result of `MonoItem::instantiation_mode`, where
/// `GloballyShared` maps to `false` and `LocalCopy` maps to `true`.
pub inlined: bool,
pub linkage: Linkage,
pub visibility: Visibility,
/// A cached copy of the result of `MonoItem::size_estimate`.
pub size_estimate: usize,
}