@@ -830,6 +830,8 @@ fn execute_optimize_work_item<B: ExtraBackendMethods>(
830
830
cgcx : & CodegenContext < B > ,
831
831
mut module : ModuleCodegen < B :: Module > ,
832
832
) -> WorkItemResult < B > {
833
+ let _timer = cgcx. prof . generic_activity_with_arg ( "codegen_module_optimize" , & * module. name ) ;
834
+
833
835
let dcx = cgcx. create_dcx ( ) ;
834
836
let dcx = dcx. handle ( ) ;
835
837
@@ -890,6 +892,10 @@ fn execute_copy_from_cache_work_item<B: ExtraBackendMethods>(
890
892
cgcx : & CodegenContext < B > ,
891
893
module : CachedModuleCodegen ,
892
894
) -> WorkItemResult < B > {
895
+ let _timer = cgcx
896
+ . prof
897
+ . generic_activity_with_arg ( "codegen_copy_artifacts_from_incr_cache" , & * module. name ) ;
898
+
893
899
let incr_comp_session_dir = cgcx. incr_comp_session_dir . as_ref ( ) . unwrap ( ) ;
894
900
895
901
let mut links_from_incr_cache = Vec :: new ( ) ;
@@ -977,6 +983,8 @@ fn execute_fat_lto_work_item<B: ExtraBackendMethods>(
977
983
mut needs_fat_lto : Vec < FatLtoInput < B > > ,
978
984
import_only_modules : Vec < ( SerializedModule < B :: ModuleBuffer > , WorkProduct ) > ,
979
985
) -> WorkItemResult < B > {
986
+ let _timer = cgcx. prof . generic_activity_with_arg ( "codegen_module_perform_lto" , "everything" ) ;
987
+
980
988
for ( module, wp) in import_only_modules {
981
989
needs_fat_lto. push ( FatLtoInput :: Serialized { name : wp. cgu_name , buffer : module } )
982
990
}
@@ -995,6 +1003,8 @@ fn execute_thin_lto_work_item<B: ExtraBackendMethods>(
995
1003
cgcx : & CodegenContext < B > ,
996
1004
module : lto:: ThinModule < B > ,
997
1005
) -> WorkItemResult < B > {
1006
+ let _timer = cgcx. prof . generic_activity_with_arg ( "codegen_module_perform_lto" , module. name ( ) ) ;
1007
+
998
1008
let module = B :: optimize_thin ( cgcx, module) ;
999
1009
let module = B :: codegen ( cgcx, module, & cgcx. module_config ) ;
1000
1010
WorkItemResult :: Finished ( module)
@@ -1714,38 +1724,21 @@ fn spawn_work<'a, B: ExtraBackendMethods>(
1714
1724
1715
1725
B :: spawn_named_thread ( cgcx. time_trace , work. short_description ( ) , move || {
1716
1726
let result = std:: panic:: catch_unwind ( AssertUnwindSafe ( || match work {
1717
- WorkItem :: Optimize ( m) => {
1718
- let _timer =
1719
- cgcx. prof . generic_activity_with_arg ( "codegen_module_optimize" , & * m. name ) ;
1720
- execute_optimize_work_item ( & cgcx, m)
1721
- }
1722
- WorkItem :: CopyPostLtoArtifacts ( m) => {
1723
- let _timer = cgcx
1724
- . prof
1725
- . generic_activity_with_arg ( "codegen_copy_artifacts_from_incr_cache" , & * m. name ) ;
1726
- execute_copy_from_cache_work_item ( & cgcx, m)
1727
- }
1727
+ WorkItem :: Optimize ( m) => execute_optimize_work_item ( & cgcx, m) ,
1728
+ WorkItem :: CopyPostLtoArtifacts ( m) => execute_copy_from_cache_work_item ( & cgcx, m) ,
1728
1729
WorkItem :: FatLto {
1729
1730
exported_symbols_for_lto,
1730
1731
each_linked_rlib_for_lto,
1731
1732
needs_fat_lto,
1732
1733
import_only_modules,
1733
- } => {
1734
- let _timer =
1735
- cgcx. prof . generic_activity_with_arg ( "codegen_module_perform_lto" , "everything" ) ;
1736
- execute_fat_lto_work_item (
1737
- & cgcx,
1738
- & exported_symbols_for_lto,
1739
- & each_linked_rlib_for_lto,
1740
- needs_fat_lto,
1741
- import_only_modules,
1742
- )
1743
- }
1744
- WorkItem :: ThinLto ( m) => {
1745
- let _timer =
1746
- cgcx. prof . generic_activity_with_arg ( "codegen_module_perform_lto" , m. name ( ) ) ;
1747
- execute_thin_lto_work_item ( & cgcx, m)
1748
- }
1734
+ } => execute_fat_lto_work_item (
1735
+ & cgcx,
1736
+ & exported_symbols_for_lto,
1737
+ & each_linked_rlib_for_lto,
1738
+ needs_fat_lto,
1739
+ import_only_modules,
1740
+ ) ,
1741
+ WorkItem :: ThinLto ( m) => execute_thin_lto_work_item ( & cgcx, m) ,
1749
1742
} ) ) ;
1750
1743
1751
1744
let msg = match result {
0 commit comments