@@ -830,6 +830,8 @@ fn execute_optimize_work_item<B: ExtraBackendMethods>(
830830 cgcx : & CodegenContext < B > ,
831831 mut module : ModuleCodegen < B :: Module > ,
832832) -> WorkItemResult < B > {
833+ let _timer = cgcx. prof . generic_activity_with_arg ( "codegen_module_optimize" , & * module. name ) ;
834+
833835 let dcx = cgcx. create_dcx ( ) ;
834836 let dcx = dcx. handle ( ) ;
835837
@@ -862,7 +864,7 @@ fn execute_optimize_work_item<B: ExtraBackendMethods>(
862864 WorkItemResult :: Finished ( module)
863865 }
864866 ComputedLtoType :: Thin => {
865- let ( name, thin_buffer) = B :: prepare_thin ( module, false ) ;
867+ let ( name, thin_buffer) = B :: prepare_thin ( module) ;
866868 if let Some ( path) = bitcode {
867869 fs:: write ( & path, thin_buffer. data ( ) ) . unwrap_or_else ( |e| {
868870 panic ! ( "Error writing pre-lto-bitcode file `{}`: {}" , path. display( ) , e) ;
@@ -890,6 +892,10 @@ fn execute_copy_from_cache_work_item<B: ExtraBackendMethods>(
890892 cgcx : & CodegenContext < B > ,
891893 module : CachedModuleCodegen ,
892894) -> WorkItemResult < B > {
895+ let _timer = cgcx
896+ . prof
897+ . generic_activity_with_arg ( "codegen_copy_artifacts_from_incr_cache" , & * module. name ) ;
898+
893899 let incr_comp_session_dir = cgcx. incr_comp_session_dir . as_ref ( ) . unwrap ( ) ;
894900
895901 let mut links_from_incr_cache = Vec :: new ( ) ;
@@ -977,6 +983,8 @@ fn execute_fat_lto_work_item<B: ExtraBackendMethods>(
977983 mut needs_fat_lto : Vec < FatLtoInput < B > > ,
978984 import_only_modules : Vec < ( SerializedModule < B :: ModuleBuffer > , WorkProduct ) > ,
979985) -> WorkItemResult < B > {
986+ let _timer = cgcx. prof . generic_activity_with_arg ( "codegen_module_perform_lto" , "everything" ) ;
987+
980988 for ( module, wp) in import_only_modules {
981989 needs_fat_lto. push ( FatLtoInput :: Serialized { name : wp. cgu_name , buffer : module } )
982990 }
@@ -995,6 +1003,8 @@ fn execute_thin_lto_work_item<B: ExtraBackendMethods>(
9951003 cgcx : & CodegenContext < B > ,
9961004 module : lto:: ThinModule < B > ,
9971005) -> WorkItemResult < B > {
1006+ let _timer = cgcx. prof . generic_activity_with_arg ( "codegen_module_perform_lto" , module. name ( ) ) ;
1007+
9981008 let module = B :: optimize_thin ( cgcx, module) ;
9991009 let module = B :: codegen ( cgcx, module, & cgcx. module_config ) ;
10001010 WorkItemResult :: Finished ( module)
@@ -1714,38 +1724,21 @@ fn spawn_work<'a, B: ExtraBackendMethods>(
17141724
17151725 B :: spawn_named_thread ( cgcx. time_trace , work. short_description ( ) , move || {
17161726 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) ,
17281729 WorkItem :: FatLto {
17291730 exported_symbols_for_lto,
17301731 each_linked_rlib_for_lto,
17311732 needs_fat_lto,
17321733 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) ,
17491742 } ) ) ;
17501743
17511744 let msg = match result {
0 commit comments