@@ -336,13 +336,13 @@ pub(crate) fn save_temp_bitcode(
336336 & module. name ,
337337 cgcx. invocation_temp . as_deref ( ) ,
338338 ) ;
339- write_bitcode_to_file ( module, & path)
339+ write_bitcode_to_file ( & module. module_llvm , & path)
340340}
341341
342- fn write_bitcode_to_file ( module : & ModuleCodegen < ModuleLlvm > , path : & Path ) {
342+ fn write_bitcode_to_file ( module : & ModuleLlvm , path : & Path ) {
343343 unsafe {
344344 let path = path_to_c_string ( & path) ;
345- let llmod = module. module_llvm . llmod ( ) ;
345+ let llmod = module. llmod ( ) ;
346346 llvm:: LLVMWriteBitcodeToFile ( llmod, path. as_ptr ( ) ) ;
347347 }
348348}
@@ -906,13 +906,8 @@ pub(crate) fn optimize(
906906 let _handlers =
907907 DiagnosticHandlers :: new ( cgcx, shared_emitter, llcx, module, CodegenDiagnosticsStage :: Opt ) ;
908908
909- if config. emit_no_opt_bc {
910- let out = cgcx. output_filenames . temp_path_ext_for_cgu (
911- "no-opt.bc" ,
912- & module. name ,
913- cgcx. invocation_temp . as_deref ( ) ,
914- ) ;
915- write_bitcode_to_file ( module, & out)
909+ if module. kind == ModuleKind :: Regular {
910+ save_temp_bitcode ( cgcx, module, "no-opt" ) ;
916911 }
917912
918913 // FIXME(ZuseZ4): support SanitizeHWAddress and prevent illegal/unsupported opts
0 commit comments