@@ -515,20 +515,23 @@ void jl_dump_native_impl(void *native_code,
515515 std::vector<NewArchiveMember> unopt_bc_Archive;
516516 std::vector<std::string> outputs;
517517
518- legacy::PassManager preopt, postopt;
518+ PassBuilder emptyPB;
519+ AnalysisManagers empty (emptyPB);
520+ ModulePassManager preopt, postopt;
521+ legacy::PassManager emitter; // MC emission is only supported on legacy PM
519522
520523 if (unopt_bc_fname)
521- preopt.add ( createBitcodeWriterPass (unopt_bc_OS));
524+ preopt.addPass ( BitcodeWriterPass (unopt_bc_OS));
522525
523- // Is this necessary for TM?
524- // addTargetPasses(&postopt, TM->getTargetTriple(), TM->getTargetIRAnalysis());
525526 if (bc_fname)
526- postopt.add (createBitcodeWriterPass (bc_OS));
527+ postopt.addPass (BitcodeWriterPass (bc_OS));
528+ // Is this necessary for TM?
529+ addTargetPasses (&emitter, TM->getTargetTriple (), TM->getTargetIRAnalysis ());
527530 if (obj_fname)
528- if (TM->addPassesToEmitFile (postopt , obj_OS, nullptr , CGFT_ObjectFile, false ))
531+ if (TM->addPassesToEmitFile (emitter , obj_OS, nullptr , CGFT_ObjectFile, false ))
529532 jl_safe_printf (" ERROR: target does not support generation of object files\n " );
530533 if (asm_fname)
531- if (TM->addPassesToEmitFile (postopt , asm_OS, nullptr , CGFT_AssemblyFile, false ))
534+ if (TM->addPassesToEmitFile (emitter , asm_OS, nullptr , CGFT_AssemblyFile, false ))
532535 jl_safe_printf (" ERROR: target does not support generation of object files\n " );
533536
534537 legacy::PassManager optimizer;
@@ -567,7 +570,7 @@ void jl_dump_native_impl(void *native_code,
567570
568571 // do the actual work
569572 auto add_output = [&] (Module &M, StringRef unopt_bc_Name, StringRef bc_Name, StringRef obj_Name, StringRef asm_Name) {
570- preopt.run (M);
573+ preopt.run (M, empty. MAM );
571574 optimizer.run (M);
572575
573576 // We would like to emit an alias or an weakref alias to redirect these symbols
@@ -585,7 +588,7 @@ void jl_dump_native_impl(void *native_code,
585588 injectCRTAlias (M, " __truncdfhf2" , " julia__truncdfhf2" ,
586589 FunctionType::get (Type::getHalfTy (Context), { Type::getDoubleTy (Context) }, false ));
587590
588- postopt.run (M);
591+ postopt.run (M, empty. MAM );
589592
590593 if (unopt_bc_fname)
591594 emit_result (unopt_bc_Archive, unopt_bc_Buffer, unopt_bc_Name, outputs);
0 commit comments