@@ -104,6 +104,7 @@ use rustc::ty::print::characteristic_def_id_of_type;
104104use rustc:: ty:: query:: Providers ;
105105use rustc:: ty:: { self , DefIdTree , InstanceDef , TyCtxt } ;
106106use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
107+ use rustc_data_structures:: sync;
107108use rustc_hir:: def:: DefKind ;
108109use rustc_hir:: def_id:: { CrateNum , DefId , DefIdSet , CRATE_DEF_INDEX , LOCAL_CRATE } ;
109110use rustc_span:: symbol:: Symbol ;
@@ -796,6 +797,8 @@ where
796797 I : Iterator < Item = & ' a MonoItem < ' tcx > > ,
797798 ' tcx : ' a ,
798799{
800+ let _prof_timer = tcx. prof . generic_activity ( "assert_symbols_are_distinct" ) ;
801+
799802 let mut symbols: Vec < _ > =
800803 mono_items. map ( |mono_item| ( mono_item, mono_item. symbol_name ( tcx) ) ) . collect ( ) ;
801804
@@ -869,18 +872,23 @@ fn collect_and_partition_mono_items(
869872
870873 tcx. sess . abort_if_errors ( ) ;
871874
872- assert_symbols_are_distinct ( tcx, items. iter ( ) ) ;
873-
874- let strategy = if tcx. sess . opts . incremental . is_some ( ) {
875- PartitioningStrategy :: PerModule
876- } else {
877- PartitioningStrategy :: FixedUnitCount ( tcx. sess . codegen_units ( ) )
878- } ;
879-
880- let codegen_units = partition ( tcx, items. iter ( ) . cloned ( ) , strategy, & inlining_map)
881- . into_iter ( )
882- . map ( Arc :: new)
883- . collect :: < Vec < _ > > ( ) ;
875+ let ( codegen_units, _) = tcx. sess . time ( "partition_and_assert_distinct_symbols" , || {
876+ sync:: join (
877+ || {
878+ let strategy = if tcx. sess . opts . incremental . is_some ( ) {
879+ PartitioningStrategy :: PerModule
880+ } else {
881+ PartitioningStrategy :: FixedUnitCount ( tcx. sess . codegen_units ( ) )
882+ } ;
883+
884+ partition ( tcx, items. iter ( ) . cloned ( ) , strategy, & inlining_map)
885+ . into_iter ( )
886+ . map ( Arc :: new)
887+ . collect :: < Vec < _ > > ( )
888+ } ,
889+ || assert_symbols_are_distinct ( tcx, items. iter ( ) ) ,
890+ )
891+ } ) ;
884892
885893 let mono_items: DefIdSet = items
886894 . iter ( )
0 commit comments