@@ -628,12 +628,10 @@ LLVMRustOptimizeWithNewPassManager(
628628 PTO.LoopVectorization = LoopVectorize;
629629 PTO.SLPVectorization = SLPVectorize;
630630
631- // FIXME: What's this?
632631 PassInstrumentationCallbacks PIC;
633632 StandardInstrumentations SI;
634633 SI.registerCallbacks (PIC);
635634
636- // FIXME: PGOOpt
637635 Optional<PGOOptions> PGOOpt;
638636 if (PGOGenPath) {
639637 assert (!PGOUsePath);
@@ -736,14 +734,12 @@ LLVMRustOptimizeWithNewPassManager(
736734 MPM.addPass (createModuleToFunctionPassAdaptor (std::move (FPM)));
737735
738736 MPM.addPass (AlwaysInlinerPass (/* InsertLifetimeIntrinsics=*/ false ));
739- // FIXME: PGO?
740737 } else {
741738 for (const auto &C : PipelineStartEPCallbacks)
742739 PB.registerPipelineStartEPCallback (C);
743740 for (const auto &C : OptimizerLastEPCallbacks)
744741 PB.registerOptimizerLastEPCallback (C);
745742
746- // FIXME: Sanitizers? PGO?
747743 if (PrepareForThinLTO) {
748744 MPM = PB.buildThinLTOPreLinkDefaultPipeline (OptLevel, DebugPassManager);
749745 } else if (PrepareForLTO) {
@@ -759,6 +755,10 @@ LLVMRustOptimizeWithNewPassManager(
759755 MPM.addPass (NameAnonGlobalPass ());
760756 }
761757
758+ // Upgrade all calls to old intrinsics first.
759+ for (Module::iterator I = TheModule->begin (), E = TheModule->end (); I != E;)
760+ UpgradeCallsToIntrinsic (&*I++); // must be post-increment, as we remove
761+
762762 MPM.run (*TheModule, MAM);
763763}
764764
0 commit comments