File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
compiler/rustc_monomorphize/src Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 165165//! regardless of whether it is actually needed or not.
166166
167167use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
168- use rustc_data_structures:: sync:: { par_for_each_in, MTLock , MTLockRef } ;
168+ use rustc_data_structures:: sync:: { join , par_for_each_in, MTLock , MTLockRef } ;
169169use rustc_hir as hir;
170170use rustc_hir:: def:: DefKind ;
171171use rustc_hir:: def_id:: { DefId , DefIdMap , LocalDefId } ;
@@ -257,8 +257,19 @@ pub fn collect_crate_mono_items(
257257) -> ( FxHashSet < MonoItem < ' _ > > , UsageMap < ' _ > ) {
258258 let _prof_timer = tcx. prof . generic_activity ( "monomorphization_collector" ) ;
259259
260- let roots =
261- tcx. sess . time ( "monomorphization_collector_root_collections" , || collect_roots ( tcx, mode) ) ;
260+ let ( roots, _) = join (
261+ || {
262+ tcx. sess
263+ . time ( "monomorphization_collector_root_collections" , || collect_roots ( tcx, mode) )
264+ } ,
265+ || {
266+ if tcx. sess . opts . share_generics ( ) {
267+ // Prefetch upstream_monomorphizations as it's very likely to be used in
268+ // code generation later and this is decent spot to compute it.
269+ tcx. ensure ( ) . upstream_monomorphizations ( ( ) ) ;
270+ }
271+ } ,
272+ ) ;
262273
263274 debug ! ( "building mono item graph, beginning at roots" ) ;
264275
You can’t perform that action at this time.
0 commit comments