@@ -134,10 +134,15 @@ pub fn partition<'tcx, I>(
134
134
where
135
135
I : Iterator < Item = MonoItem < ' tcx > > ,
136
136
{
137
+ let _prof_timer = tcx. prof . generic_activity ( "cgu_partitioning" ) ;
138
+
137
139
// In the first step, we place all regular monomorphizations into their
138
140
// respective 'home' codegen unit. Regular monomorphizations are all
139
141
// 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
+ } ;
141
146
142
147
initial_partitioning. codegen_units . iter_mut ( ) . for_each ( |cgu| cgu. estimate_size ( tcx) ) ;
143
148
@@ -146,17 +151,20 @@ where
146
151
// If the partitioning should produce a fixed count of codegen units, merge
147
152
// until that count is reached.
148
153
if let PartitioningStrategy :: FixedUnitCount ( count) = strategy {
154
+ let _prof_timer = tcx. prof . generic_activity ( "cgu_partitioning_merge_cgus" ) ;
149
155
merge_codegen_units ( tcx, & mut initial_partitioning, count) ;
150
-
151
156
debug_dump ( tcx, "POST MERGING:" , initial_partitioning. codegen_units . iter ( ) ) ;
152
157
}
153
158
154
159
// In the next step, we use the inlining map to determine which additional
155
160
// monomorphizations have to go into each codegen unit. These additional
156
161
// monomorphizations can be drop-glue, functions from external crates, and
157
162
// 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
+ } ;
160
168
161
169
post_inlining. codegen_units . iter_mut ( ) . for_each ( |cgu| cgu. estimate_size ( tcx) ) ;
162
170
@@ -165,6 +173,8 @@ where
165
173
// Next we try to make as many symbols "internal" as possible, so LLVM has
166
174
// more freedom to optimize.
167
175
if !tcx. sess . opts . cg . link_dead_code {
176
+ let _prof_timer =
177
+ tcx. prof . generic_activity ( "cgu_partitioning_internalize_symbols" ) ;
168
178
internalize_symbols ( tcx, & mut post_inlining, inlining_map) ;
169
179
}
170
180
0 commit comments