@@ -822,6 +822,8 @@ fn execute_optimize_work_item<B: ExtraBackendMethods>(
822
822
cgcx : & CodegenContext < B > ,
823
823
mut module : ModuleCodegen < B :: Module > ,
824
824
) -> WorkItemResult < B > {
825
+ let _timer = cgcx. prof . generic_activity_with_arg ( "codegen_module_optimize" , & * module. name ) ;
826
+
825
827
let dcx = cgcx. create_dcx ( ) ;
826
828
let dcx = dcx. handle ( ) ;
827
829
@@ -877,6 +879,10 @@ fn execute_copy_from_cache_work_item<B: ExtraBackendMethods>(
877
879
cgcx : & CodegenContext < B > ,
878
880
module : CachedModuleCodegen ,
879
881
) -> WorkItemResult < B > {
882
+ let _timer = cgcx
883
+ . prof
884
+ . generic_activity_with_arg ( "codegen_copy_artifacts_from_incr_cache" , & * module. name ) ;
885
+
880
886
let incr_comp_session_dir = cgcx. incr_comp_session_dir . as_ref ( ) . unwrap ( ) ;
881
887
882
888
let mut links_from_incr_cache = Vec :: new ( ) ;
@@ -963,6 +969,8 @@ fn execute_fat_lto_work_item<B: ExtraBackendMethods>(
963
969
mut needs_fat_lto : Vec < FatLtoInput < B > > ,
964
970
import_only_modules : Vec < ( SerializedModule < B :: ModuleBuffer > , WorkProduct ) > ,
965
971
) -> WorkItemResult < B > {
972
+ let _timer = cgcx. prof . generic_activity_with_arg ( "codegen_module_perform_lto" , "everything" ) ;
973
+
966
974
for ( module, wp) in import_only_modules {
967
975
needs_fat_lto. push ( FatLtoInput :: Serialized { name : wp. cgu_name , buffer : module } )
968
976
}
@@ -981,6 +989,8 @@ fn execute_thin_lto_work_item<B: ExtraBackendMethods>(
981
989
cgcx : & CodegenContext < B > ,
982
990
module : lto:: ThinModule < B > ,
983
991
) -> WorkItemResult < B > {
992
+ let _timer = cgcx. prof . generic_activity_with_arg ( "codegen_module_perform_lto" , module. name ( ) ) ;
993
+
984
994
let module = B :: optimize_thin ( cgcx, module) ;
985
995
let module = B :: codegen ( cgcx, module, & cgcx. module_config ) ;
986
996
WorkItemResult :: Finished ( module)
@@ -1693,38 +1703,21 @@ fn spawn_work<'a, B: ExtraBackendMethods>(
1693
1703
1694
1704
B :: spawn_named_thread ( cgcx. time_trace , work. short_description ( ) , move || {
1695
1705
let result = std:: panic:: catch_unwind ( AssertUnwindSafe ( || match work {
1696
- WorkItem :: Optimize ( m) => {
1697
- let _timer =
1698
- cgcx. prof . generic_activity_with_arg ( "codegen_module_optimize" , & * m. name ) ;
1699
- execute_optimize_work_item ( & cgcx, m)
1700
- }
1701
- WorkItem :: CopyPostLtoArtifacts ( m) => {
1702
- let _timer = cgcx
1703
- . prof
1704
- . generic_activity_with_arg ( "codegen_copy_artifacts_from_incr_cache" , & * m. name ) ;
1705
- execute_copy_from_cache_work_item ( & cgcx, m)
1706
- }
1706
+ WorkItem :: Optimize ( m) => execute_optimize_work_item ( & cgcx, m) ,
1707
+ WorkItem :: CopyPostLtoArtifacts ( m) => execute_copy_from_cache_work_item ( & cgcx, m) ,
1707
1708
WorkItem :: FatLto {
1708
1709
exported_symbols_for_lto,
1709
1710
each_linked_rlib_for_lto,
1710
1711
needs_fat_lto,
1711
1712
import_only_modules,
1712
- } => {
1713
- let _timer =
1714
- cgcx. prof . generic_activity_with_arg ( "codegen_module_perform_lto" , "everything" ) ;
1715
- execute_fat_lto_work_item (
1716
- & cgcx,
1717
- & exported_symbols_for_lto,
1718
- & each_linked_rlib_for_lto,
1719
- needs_fat_lto,
1720
- import_only_modules,
1721
- )
1722
- }
1723
- WorkItem :: ThinLto ( m) => {
1724
- let _timer =
1725
- cgcx. prof . generic_activity_with_arg ( "codegen_module_perform_lto" , m. name ( ) ) ;
1726
- execute_thin_lto_work_item ( & cgcx, m)
1727
- }
1713
+ } => execute_fat_lto_work_item (
1714
+ & cgcx,
1715
+ & exported_symbols_for_lto,
1716
+ & each_linked_rlib_for_lto,
1717
+ needs_fat_lto,
1718
+ import_only_modules,
1719
+ ) ,
1720
+ WorkItem :: ThinLto ( m) => execute_thin_lto_work_item ( & cgcx, m) ,
1728
1721
} ) ) ;
1729
1722
1730
1723
let msg = match result {
0 commit comments