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 165
165
//! regardless of whether it is actually needed or not.
166
166
167
167
use 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 } ;
169
169
use rustc_hir as hir;
170
170
use rustc_hir:: def:: DefKind ;
171
171
use rustc_hir:: def_id:: { DefId , DefIdMap , LocalDefId } ;
@@ -259,8 +259,19 @@ pub fn collect_crate_mono_items(
259
259
) -> ( FxHashSet < MonoItem < ' _ > > , UsageMap < ' _ > ) {
260
260
let _prof_timer = tcx. prof . generic_activity ( "monomorphization_collector" ) ;
261
261
262
- let roots =
263
- tcx. sess . time ( "monomorphization_collector_root_collections" , || collect_roots ( tcx, mode) ) ;
262
+ let ( roots, _) = join (
263
+ || {
264
+ tcx. sess
265
+ . time ( "monomorphization_collector_root_collections" , || collect_roots ( tcx, mode) )
266
+ } ,
267
+ || {
268
+ if tcx. sess . opts . share_generics ( ) {
269
+ // Prefetch upstream_monomorphizations as it's very likely to be used in
270
+ // code generation later and this is decent spot to compute it.
271
+ tcx. ensure ( ) . upstream_monomorphizations ( ( ) ) ;
272
+ }
273
+ } ,
274
+ ) ;
264
275
265
276
debug ! ( "building mono item graph, beginning at roots" ) ;
266
277
You can’t perform that action at this time.
0 commit comments