@@ -134,10 +134,15 @@ pub fn partition<'tcx, I>(
134134where
135135 I : Iterator < Item = MonoItem < ' tcx > > ,
136136{
137+ let _prof_timer = tcx. prof . generic_activity ( "cgu_partitioning" ) ;
138+
137139 // In the first step, we place all regular monomorphizations into their
138140 // respective 'home' codegen unit. Regular monomorphizations are all
139141 // functions and statics defined in the local crate.
140- let mut initial_partitioning = place_root_mono_items ( tcx, mono_items) ;
142+ let mut initial_partitioning = {
143+ let _prof_timer = tcx. prof . generic_activity ( "cgu_partitioning_place_roots" ) ;
144+ place_root_mono_items ( tcx, mono_items)
145+ } ;
141146
142147 initial_partitioning. codegen_units . iter_mut ( ) . for_each ( |cgu| cgu. estimate_size ( tcx) ) ;
143148
@@ -146,17 +151,20 @@ where
146151 // If the partitioning should produce a fixed count of codegen units, merge
147152 // until that count is reached.
148153 if let PartitioningStrategy :: FixedUnitCount ( count) = strategy {
154+ let _prof_timer = tcx. prof . generic_activity ( "cgu_partitioning_merge_cgus" ) ;
149155 merge_codegen_units ( tcx, & mut initial_partitioning, count) ;
150-
151156 debug_dump ( tcx, "POST MERGING:" , initial_partitioning. codegen_units . iter ( ) ) ;
152157 }
153158
154159 // In the next step, we use the inlining map to determine which additional
155160 // monomorphizations have to go into each codegen unit. These additional
156161 // monomorphizations can be drop-glue, functions from external crates, and
157162 // local functions the definition of which is marked with `#[inline]`.
158- let mut post_inlining = place_inlined_mono_items ( initial_partitioning,
159- inlining_map) ;
163+ let mut post_inlining = {
164+ let _prof_timer =
165+ tcx. prof . generic_activity ( "cgu_partitioning_place_inline_items" ) ;
166+ place_inlined_mono_items ( initial_partitioning, inlining_map)
167+ } ;
160168
161169 post_inlining. codegen_units . iter_mut ( ) . for_each ( |cgu| cgu. estimate_size ( tcx) ) ;
162170
@@ -165,6 +173,8 @@ where
165173 // Next we try to make as many symbols "internal" as possible, so LLVM has
166174 // more freedom to optimize.
167175 if !tcx. sess . opts . cg . link_dead_code {
176+ let _prof_timer =
177+ tcx. prof . generic_activity ( "cgu_partitioning_internalize_symbols" ) ;
168178 internalize_symbols ( tcx, & mut post_inlining, inlining_map) ;
169179 }
170180
0 commit comments