@@ -528,12 +528,20 @@ fn copy_all_cgu_workproducts_to_incr_comp_cache_dir(
528528    for  module in  compiled_modules. modules . iter ( ) . filter ( |m| m. kind  == ModuleKind :: Regular )  { 
529529        let  mut  files = Vec :: new ( ) ; 
530530        if  let  Some ( object_file_path)  = & module. object  { 
531-             files. push ( ( "o" ,  object_file_path. as_path ( ) ) ) ; 
531+             files. push ( ( OutputType :: Object . extension ( ) ,  object_file_path. as_path ( ) ) ) ; 
532532        } 
533533        if  let  Some ( dwarf_object_file_path)  = & module. dwarf_object  { 
534534            files. push ( ( "dwo" ,  dwarf_object_file_path. as_path ( ) ) ) ; 
535535        } 
536- 
536+         if  let  Some ( path)  = & module. assembly  { 
537+             files. push ( ( OutputType :: Assembly . extension ( ) ,  path. as_path ( ) ) ) ; 
538+         } 
539+         if  let  Some ( path)  = & module. llvm_ir  { 
540+             files. push ( ( OutputType :: LlvmAssembly . extension ( ) ,  path. as_path ( ) ) ) ; 
541+         } 
542+         if  let  Some ( path)  = & module. bytecode  { 
543+             files. push ( ( OutputType :: Bitcode . extension ( ) ,  path. as_path ( ) ) ) ; 
544+         } 
537545        if  let  Some ( ( id,  product) )  =
538546            copy_cgu_workproduct_to_incr_comp_cache_dir ( sess,  & module. name ,  files. as_slice ( ) ) 
539547        { 
@@ -937,12 +945,28 @@ fn execute_copy_from_cache_work_item<B: ExtraBackendMethods>(
937945            load_from_incr_comp_dir ( dwarf_obj_out,  saved_dwarf_object_file) 
938946        } ) ; 
939947
948+     let  load_from_incr_cache = |perform,  output_type :  OutputType | { 
949+         if  perform { 
950+             let  saved_file = module. source . saved_files . get ( output_type. extension ( ) ) ?; 
951+             let  output_path = cgcx. output_filenames . temp_path ( output_type,  Some ( & module. name ) ) ; 
952+             load_from_incr_comp_dir ( output_path,  & saved_file) 
953+         }  else  { 
954+             None 
955+         } 
956+     } ; 
957+ 
958+     let  assembly = load_from_incr_cache ( module_config. emit_asm ,  OutputType :: Assembly ) ; 
959+     let  llvm_ir = load_from_incr_cache ( module_config. emit_ir ,  OutputType :: LlvmAssembly ) ; 
960+     let  bytecode = load_from_incr_cache ( module_config. emit_bc ,  OutputType :: Bitcode ) ; 
961+ 
940962    WorkItemResult :: Finished ( CompiledModule  { 
941963        name :  module. name , 
942964        kind :  ModuleKind :: Regular , 
943965        object, 
944966        dwarf_object, 
945-         bytecode :  None , 
967+         bytecode, 
968+         assembly, 
969+         llvm_ir, 
946970    } ) 
947971} 
948972
0 commit comments