@@ -797,10 +797,6 @@ pub(crate) enum WorkItemResult<B: WriteBackendMethods> {
797
797
/// The backend has finished compiling a CGU, nothing more required.
798
798
Finished ( CompiledModule ) ,
799
799
800
- /// The backend has finished compiling a CGU, which now needs linking
801
- /// because `-Zcombine-cgu` was specified.
802
- NeedsLink ( ModuleCodegen < B :: Module > ) ,
803
-
804
800
/// The backend has finished compiling a CGU, which now needs to go through
805
801
/// fat LTO.
806
802
NeedsFatLto ( FatLtoInput < B > ) ,
@@ -884,7 +880,10 @@ fn execute_optimize_work_item<B: ExtraBackendMethods>(
884
880
} ;
885
881
886
882
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
+ }
888
887
ComputedLtoType :: Thin => {
889
888
let ( name, thin_buffer) = B :: prepare_thin ( module, false ) ;
890
889
if let Some ( path) = bitcode {
@@ -1024,20 +1023,8 @@ fn execute_thin_lto_work_item<B: ExtraBackendMethods>(
1024
1023
module_config : & ModuleConfig ,
1025
1024
) -> Result < WorkItemResult < B > , FatalError > {
1026
1025
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) )
1041
1028
}
1042
1029
1043
1030
/// Messages sent to the coordinator.
@@ -1343,7 +1330,6 @@ fn start_executing_work<B: ExtraBackendMethods>(
1343
1330
// through codegen and LLVM.
1344
1331
let mut compiled_modules = vec ! [ ] ;
1345
1332
let mut compiled_allocator_module = None ;
1346
- let mut needs_link = Vec :: new ( ) ;
1347
1333
let mut needs_fat_lto = Vec :: new ( ) ;
1348
1334
let mut needs_thin_lto = Vec :: new ( ) ;
1349
1335
let mut lto_import_only_modules = Vec :: new ( ) ;
@@ -1625,7 +1611,6 @@ fn start_executing_work<B: ExtraBackendMethods>(
1625
1611
Ok ( WorkItemResult :: Finished ( compiled_module) ) => {
1626
1612
match compiled_module. kind {
1627
1613
ModuleKind :: Regular => {
1628
- assert ! ( needs_link. is_empty( ) ) ;
1629
1614
compiled_modules. push ( compiled_module) ;
1630
1615
}
1631
1616
ModuleKind :: Allocator => {
@@ -1634,10 +1619,6 @@ fn start_executing_work<B: ExtraBackendMethods>(
1634
1619
}
1635
1620
}
1636
1621
}
1637
- Ok ( WorkItemResult :: NeedsLink ( module) ) => {
1638
- assert ! ( compiled_modules. is_empty( ) ) ;
1639
- needs_link. push ( module) ;
1640
- }
1641
1622
Ok ( WorkItemResult :: NeedsFatLto ( fat_lto_input) ) => {
1642
1623
assert ! ( !started_lto) ;
1643
1624
assert ! ( needs_thin_lto. is_empty( ) ) ;
@@ -1674,17 +1655,6 @@ fn start_executing_work<B: ExtraBackendMethods>(
1674
1655
return Err ( ( ) ) ;
1675
1656
}
1676
1657
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
-
1688
1658
// Drop to print timings
1689
1659
drop ( llvm_start_time) ;
1690
1660
0 commit comments