@@ -250,13 +250,13 @@ where
250
250
cgu. create_size_estimate ( tcx) ;
251
251
}
252
252
253
- debug_dump ( tcx, "INITIAL PARTITIONING: " , initial_partitioning. codegen_units . iter ( ) ) ;
253
+ debug_dump ( tcx, "INITIAL PARTITIONING" , & initial_partitioning. codegen_units ) ;
254
254
255
255
// Merge until we have at most `max_cgu_count` codegen units.
256
256
{
257
257
let _prof_timer = tcx. prof . generic_activity ( "cgu_partitioning_merge_cgus" ) ;
258
258
partitioner. merge_codegen_units ( cx, & mut initial_partitioning) ;
259
- debug_dump ( tcx, "POST MERGING: " , initial_partitioning. codegen_units . iter ( ) ) ;
259
+ debug_dump ( tcx, "POST MERGING" , & initial_partitioning. codegen_units ) ;
260
260
}
261
261
262
262
// In the next step, we use the inlining map to determine which additional
@@ -272,7 +272,7 @@ where
272
272
cgu. create_size_estimate ( tcx) ;
273
273
}
274
274
275
- debug_dump ( tcx, "POST INLINING: " , post_inlining. codegen_units . iter ( ) ) ;
275
+ debug_dump ( tcx, "POST INLINING" , & post_inlining. codegen_units ) ;
276
276
277
277
// Next we try to make as many symbols "internal" as possible, so LLVM has
278
278
// more freedom to optimize.
@@ -322,6 +322,8 @@ where
322
322
323
323
result. sort_by ( |a, b| a. name ( ) . as_str ( ) . cmp ( b. name ( ) . as_str ( ) ) ) ;
324
324
325
+ debug_dump ( tcx, "FINAL" , & result) ;
326
+
325
327
result
326
328
}
327
329
@@ -346,33 +348,37 @@ struct PostInliningPartitioning<'tcx> {
346
348
internalization_candidates : FxHashSet < MonoItem < ' tcx > > ,
347
349
}
348
350
349
- fn debug_dump < ' a , ' tcx , I > ( tcx : TyCtxt < ' tcx > , label : & str , cgus : I )
350
- where
351
- I : Iterator < Item = & ' a CodegenUnit < ' tcx > > ,
352
- ' tcx : ' a ,
353
- {
351
+ fn debug_dump < ' a , ' tcx : ' a > ( tcx : TyCtxt < ' tcx > , label : & str , cgus : & [ CodegenUnit < ' tcx > ] ) {
354
352
let dump = move || {
355
353
use std:: fmt:: Write ;
356
354
355
+ let num_cgus = cgus. len ( ) ;
356
+ let max = cgus. iter ( ) . map ( |cgu| cgu. size_estimate ( ) ) . max ( ) . unwrap ( ) ;
357
+ let min = cgus. iter ( ) . map ( |cgu| cgu. size_estimate ( ) ) . min ( ) . unwrap ( ) ;
358
+ let ratio = max as f64 / min as f64 ;
359
+
357
360
let s = & mut String :: new ( ) ;
358
- let _ = writeln ! ( s, "{label}" ) ;
361
+ let _ = writeln ! (
362
+ s,
363
+ "{label} ({num_cgus} CodegenUnits, max={max}, min={min}, max/min={ratio:.1}):"
364
+ ) ;
359
365
for cgu in cgus {
360
366
let _ =
361
- writeln ! ( s, "CodegenUnit {} estimated size {} :" , cgu. name( ) , cgu. size_estimate( ) ) ;
367
+ writeln ! ( s, "CodegenUnit {} estimated size {}:" , cgu. name( ) , cgu. size_estimate( ) ) ;
362
368
363
369
for ( mono_item, linkage) in cgu. items ( ) {
364
370
let symbol_name = mono_item. symbol_name ( tcx) . name ;
365
371
let symbol_hash_start = symbol_name. rfind ( 'h' ) ;
366
372
let symbol_hash = symbol_hash_start. map_or ( "<no hash>" , |i| & symbol_name[ i..] ) ;
367
373
368
- let _ = writeln ! (
374
+ let _ = with_no_trimmed_paths ! ( writeln!(
369
375
s,
370
376
" - {} [{:?}] [{}] estimated size {}" ,
371
377
mono_item,
372
378
linkage,
373
379
symbol_hash,
374
380
mono_item. size_estimate( tcx)
375
- ) ;
381
+ ) ) ;
376
382
}
377
383
378
384
let _ = writeln ! ( s) ;
0 commit comments