Don't compute inlining status of mono items in advance.
We record inlining status for mono items in `MonoItems`, and then transfer it to `InliningMap`, for later use in `InliningMap::with_inlining_candidates`. But we can just compute inlining status directly in `InliningMap::with_inlining_candidates`, because the mono item is right there. There's no need to compute it in advance. This commit changes the code to do that, removing the need for `MonoItems` and `InliningMap::inlines`. This does result in more calls to `instantiation_mode` (one per static occurrence) but the performance effect is negligible.
This commit is contained in:
parent
e29821ff85
commit
cc21d9aa52
2 changed files with 17 additions and 66 deletions
|
@ -424,7 +424,7 @@ fn place_inlined_mono_items<'tcx>(
|
|||
// Collect all items that need to be available in this codegen unit.
|
||||
let mut reachable = FxHashSet::default();
|
||||
for root in old_codegen_unit.items().keys() {
|
||||
follow_inlining(*root, cx.inlining_map, &mut reachable);
|
||||
follow_inlining(cx.tcx, *root, cx.inlining_map, &mut reachable);
|
||||
}
|
||||
|
||||
let mut new_codegen_unit = CodegenUnit::new(old_codegen_unit.name());
|
||||
|
@ -478,6 +478,7 @@ fn place_inlined_mono_items<'tcx>(
|
|||
return mono_item_placements;
|
||||
|
||||
fn follow_inlining<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
mono_item: MonoItem<'tcx>,
|
||||
inlining_map: &InliningMap<'tcx>,
|
||||
visited: &mut FxHashSet<MonoItem<'tcx>>,
|
||||
|
@ -486,8 +487,8 @@ fn place_inlined_mono_items<'tcx>(
|
|||
return;
|
||||
}
|
||||
|
||||
inlining_map.with_inlining_candidates(mono_item, |target| {
|
||||
follow_inlining(target, inlining_map, visited);
|
||||
inlining_map.with_inlining_candidates(tcx, mono_item, |target| {
|
||||
follow_inlining(tcx, target, inlining_map, visited);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue