diff --git a/src/librustc_codegen_llvm/back/write.rs b/src/librustc_codegen_llvm/back/write.rs index 9cf8a47446957..59b735847f18d 100644 --- a/src/librustc_codegen_llvm/back/write.rs +++ b/src/librustc_codegen_llvm/back/write.rs @@ -365,7 +365,7 @@ pub(crate) unsafe fn optimize( .map(|path_buf| CString::new(path_buf.to_string_lossy().as_bytes()).unwrap()); // FIXME: NewPM doesn't seem to have a facility to provide custom InlineParams. - // FIXME: Extra passes. + // FIXME: Support extra passes. llvm::LLVMRustOptimizeWithNewPassManager( llmod, tm, diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp index 5dbbce635c24e..8cdc8cc860da8 100644 --- a/src/rustllvm/PassWrapper.cpp +++ b/src/rustllvm/PassWrapper.cpp @@ -628,12 +628,10 @@ LLVMRustOptimizeWithNewPassManager( PTO.LoopVectorization = LoopVectorize; PTO.SLPVectorization = SLPVectorize; - // FIXME: What's this? PassInstrumentationCallbacks PIC; StandardInstrumentations SI; SI.registerCallbacks(PIC); - // FIXME: PGOOpt Optional PGOOpt; if (PGOGenPath) { assert(!PGOUsePath); @@ -736,14 +734,12 @@ LLVMRustOptimizeWithNewPassManager( MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM))); MPM.addPass(AlwaysInlinerPass(/*InsertLifetimeIntrinsics=*/false)); - // FIXME: PGO? } else { for (const auto &C : PipelineStartEPCallbacks) PB.registerPipelineStartEPCallback(C); for (const auto &C : OptimizerLastEPCallbacks) PB.registerOptimizerLastEPCallback(C); - // FIXME: Sanitizers? PGO? if (PrepareForThinLTO) { MPM = PB.buildThinLTOPreLinkDefaultPipeline(OptLevel, DebugPassManager); } else if (PrepareForLTO) { @@ -759,6 +755,10 @@ LLVMRustOptimizeWithNewPassManager( MPM.addPass(NameAnonGlobalPass()); } + // Upgrade all calls to old intrinsics first. + for (Module::iterator I = TheModule->begin(), E = TheModule->end(); I != E;) + UpgradeCallsToIntrinsic(&*I++); // must be post-increment, as we remove + MPM.run(*TheModule, MAM); }