@@ -380,32 +380,33 @@ fn generate_lto_work<B: ExtraBackendMethods>(
380
380
) -> Vec < ( WorkItem < B > , u64 ) > {
381
381
let _prof_timer = cgcx. prof . generic_activity ( "codegen_generate_lto_work" ) ;
382
382
383
- let ( lto_modules , copy_jobs ) = if !needs_fat_lto. is_empty ( ) {
383
+ if !needs_fat_lto. is_empty ( ) {
384
384
assert ! ( needs_thin_lto. is_empty( ) ) ;
385
- let lto_module =
385
+ let module =
386
386
B :: run_fat_lto ( cgcx, needs_fat_lto, import_only_modules) . unwrap_or_else ( |e| e. raise ( ) ) ;
387
- ( vec ! [ lto_module] , vec ! [ ] )
387
+ // We are adding a single work item, so the cost doesn't matter.
388
+ vec ! [ ( WorkItem :: LTO ( module) , 0 ) ]
388
389
} else {
389
390
assert ! ( needs_fat_lto. is_empty( ) ) ;
390
- B :: run_thin_lto ( cgcx, needs_thin_lto, import_only_modules) . unwrap_or_else ( |e| e . raise ( ) )
391
- } ;
392
-
393
- lto_modules
394
- . into_iter ( )
395
- . map ( |module| {
396
- let cost = module. cost ( ) ;
397
- ( WorkItem :: LTO ( module ) , cost )
398
- } )
399
- . chain ( copy_jobs . into_iter ( ) . map ( |wp| {
400
- (
401
- WorkItem :: CopyPostLtoArtifacts ( CachedModuleCodegen {
402
- name : wp. cgu_name . clone ( ) ,
403
- source : wp ,
404
- } ) ,
405
- 0 ,
406
- )
407
- } ) )
408
- . collect ( )
391
+ let ( lto_modules , copy_jobs ) = B :: run_thin_lto ( cgcx, needs_thin_lto, import_only_modules)
392
+ . unwrap_or_else ( |e| e . raise ( ) ) ;
393
+ lto_modules
394
+ . into_iter ( )
395
+ . map ( |module| {
396
+ let cost = module . cost ( ) ;
397
+ ( WorkItem :: LTO ( module) , cost)
398
+ } )
399
+ . chain ( copy_jobs . into_iter ( ) . map ( |wp| {
400
+ (
401
+ WorkItem :: CopyPostLtoArtifacts ( CachedModuleCodegen {
402
+ name : wp . cgu_name . clone ( ) ,
403
+ source : wp,
404
+ } ) ,
405
+ 0 , // copying is very cheap
406
+ )
407
+ } ) )
408
+ . collect ( )
409
+ }
409
410
}
410
411
411
412
pub struct CompiledModules {
0 commit comments