@@ -797,10 +797,6 @@ pub(crate) enum WorkItemResult<B: WriteBackendMethods> {
797797 /// The backend has finished compiling a CGU, nothing more required.
798798 Finished ( CompiledModule ) ,
799799
800- /// The backend has finished compiling a CGU, which now needs linking
801- /// because `-Zcombine-cgu` was specified.
802- NeedsLink ( ModuleCodegen < B :: Module > ) ,
803-
804800 /// The backend has finished compiling a CGU, which now needs to go through
805801 /// fat LTO.
806802 NeedsFatLto ( FatLtoInput < B > ) ,
@@ -884,7 +880,10 @@ fn execute_optimize_work_item<B: ExtraBackendMethods>(
884880 } ;
885881
886882 match lto_type {
887- ComputedLtoType :: No => finish_intra_module_work ( cgcx, module, module_config) ,
883+ ComputedLtoType :: No => {
884+ let module = B :: codegen ( cgcx, module, module_config) ?;
885+ Ok ( WorkItemResult :: Finished ( module) )
886+ }
888887 ComputedLtoType :: Thin => {
889888 let ( name, thin_buffer) = B :: prepare_thin ( module, false ) ;
890889 if let Some ( path) = bitcode {
@@ -1024,20 +1023,8 @@ fn execute_thin_lto_work_item<B: ExtraBackendMethods>(
10241023 module_config : & ModuleConfig ,
10251024) -> Result < WorkItemResult < B > , FatalError > {
10261025 let module = B :: optimize_thin ( cgcx, module) ?;
1027- finish_intra_module_work ( cgcx, module, module_config)
1028- }
1029-
1030- fn finish_intra_module_work < B : ExtraBackendMethods > (
1031- cgcx : & CodegenContext < B > ,
1032- module : ModuleCodegen < B :: Module > ,
1033- module_config : & ModuleConfig ,
1034- ) -> Result < WorkItemResult < B > , FatalError > {
1035- if !cgcx. opts . unstable_opts . combine_cgu || module. kind == ModuleKind :: Allocator {
1036- let module = B :: codegen ( cgcx, module, module_config) ?;
1037- Ok ( WorkItemResult :: Finished ( module) )
1038- } else {
1039- Ok ( WorkItemResult :: NeedsLink ( module) )
1040- }
1026+ let module = B :: codegen ( cgcx, module, module_config) ?;
1027+ Ok ( WorkItemResult :: Finished ( module) )
10411028}
10421029
10431030/// Messages sent to the coordinator.
@@ -1343,7 +1330,6 @@ fn start_executing_work<B: ExtraBackendMethods>(
13431330 // through codegen and LLVM.
13441331 let mut compiled_modules = vec ! [ ] ;
13451332 let mut compiled_allocator_module = None ;
1346- let mut needs_link = Vec :: new ( ) ;
13471333 let mut needs_fat_lto = Vec :: new ( ) ;
13481334 let mut needs_thin_lto = Vec :: new ( ) ;
13491335 let mut lto_import_only_modules = Vec :: new ( ) ;
@@ -1625,7 +1611,6 @@ fn start_executing_work<B: ExtraBackendMethods>(
16251611 Ok ( WorkItemResult :: Finished ( compiled_module) ) => {
16261612 match compiled_module. kind {
16271613 ModuleKind :: Regular => {
1628- assert ! ( needs_link. is_empty( ) ) ;
16291614 compiled_modules. push ( compiled_module) ;
16301615 }
16311616 ModuleKind :: Allocator => {
@@ -1634,10 +1619,6 @@ fn start_executing_work<B: ExtraBackendMethods>(
16341619 }
16351620 }
16361621 }
1637- Ok ( WorkItemResult :: NeedsLink ( module) ) => {
1638- assert ! ( compiled_modules. is_empty( ) ) ;
1639- needs_link. push ( module) ;
1640- }
16411622 Ok ( WorkItemResult :: NeedsFatLto ( fat_lto_input) ) => {
16421623 assert ! ( !started_lto) ;
16431624 assert ! ( needs_thin_lto. is_empty( ) ) ;
@@ -1674,17 +1655,6 @@ fn start_executing_work<B: ExtraBackendMethods>(
16741655 return Err ( ( ) ) ;
16751656 }
16761657
1677- let needs_link = mem:: take ( & mut needs_link) ;
1678- if !needs_link. is_empty ( ) {
1679- assert ! ( compiled_modules. is_empty( ) ) ;
1680- let dcx = cgcx. create_dcx ( ) ;
1681- let dcx = dcx. handle ( ) ;
1682- let module = B :: run_link ( & cgcx, dcx, needs_link) . map_err ( |_| ( ) ) ?;
1683- let module =
1684- B :: codegen ( & cgcx, module, cgcx. config ( ModuleKind :: Regular ) ) . map_err ( |_| ( ) ) ?;
1685- compiled_modules. push ( module) ;
1686- }
1687-
16881658 // Drop to print timings
16891659 drop ( llvm_start_time) ;
16901660
0 commit comments