From 0d86fc65babcbffdd16559b9fd685f8bf33dc886 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 13 Apr 2022 10:35:42 +0200 Subject: [PATCH] [LTO] Remove legacy PM support We don't have any places setting NewPM=false anymore, so drop the support code in LTOBackend. --- llvm/include/llvm/LTO/Config.h | 3 --- llvm/lib/LTO/LTO.cpp | 1 - llvm/lib/LTO/LTOBackend.cpp | 42 ++---------------------------------------- 3 files changed, 2 insertions(+), 44 deletions(-) diff --git a/llvm/include/llvm/LTO/Config.h b/llvm/include/llvm/LTO/Config.h index 6142952..dd4f8da 100644 --- a/llvm/include/llvm/LTO/Config.h +++ b/llvm/include/llvm/LTO/Config.h @@ -57,9 +57,6 @@ struct Config { unsigned OptLevel = 2; bool DisableVerify = false; - /// Use the new pass manager - bool UseNewPM = true; - /// Use the standard optimization pipeline. bool UseDefaultPipeline = false; diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp index 24ac938..69188a4 100644 --- a/llvm/lib/LTO/LTO.cpp +++ b/llvm/lib/LTO/LTO.cpp @@ -134,7 +134,6 @@ void llvm::computeLTOCacheKey( AddUnsigned(Conf.CGOptLevel); AddUnsigned(Conf.CGFileType); AddUnsigned(Conf.OptLevel); - AddUnsigned(Conf.UseNewPM); AddUnsigned(Conf.Freestanding); AddString(Conf.OptPipeline); AddString(Conf.AAPipeline); diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp index 91807b1..9dc8bc3 100644 --- a/llvm/lib/LTO/LTOBackend.cpp +++ b/llvm/lib/LTO/LTOBackend.cpp @@ -42,7 +42,6 @@ #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Transforms/IPO.h" -#include "llvm/Transforms/IPO/PassManagerBuilder.h" #include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/Transforms/Utils/FunctionImportUtils.h" #include "llvm/Transforms/Utils/SplitModule.h" @@ -312,39 +311,6 @@ static void runNewPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM, MPM.run(Mod, MAM); } -static void runOldPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM, - bool IsThinLTO, ModuleSummaryIndex *ExportSummary, - const ModuleSummaryIndex *ImportSummary) { - legacy::PassManager passes; - passes.add(createTargetTransformInfoWrapperPass(TM->getTargetIRAnalysis())); - - PassManagerBuilder PMB; - PMB.LibraryInfo = new TargetLibraryInfoImpl(Triple(TM->getTargetTriple())); - if (Conf.Freestanding) - PMB.LibraryInfo->disableAllFunctions(); - PMB.Inliner = createFunctionInliningPass(); - PMB.ExportSummary = ExportSummary; - PMB.ImportSummary = ImportSummary; - // Unconditionally verify input since it is not verified before this - // point and has unknown origin. - PMB.VerifyInput = true; - PMB.VerifyOutput = !Conf.DisableVerify; - PMB.LoopVectorize = true; - PMB.SLPVectorize = true; - PMB.OptLevel = Conf.OptLevel; - PMB.PGOSampleUse = Conf.SampleProfile; - PMB.EnablePGOCSInstrGen = Conf.RunCSIRInstr; - if (!Conf.RunCSIRInstr && !Conf.CSIRProfile.empty()) { - PMB.EnablePGOCSInstrUse = true; - PMB.PGOInstrUse = Conf.CSIRProfile; - } - if (IsThinLTO) - PMB.populateThinLTOPassManager(passes); - else - PMB.populateLTOPassManager(passes); - passes.run(Mod); -} - bool lto::opt(const Config &Conf, TargetMachine *TM, unsigned Task, Module &Mod, bool IsThinLTO, ModuleSummaryIndex *ExportSummary, const ModuleSummaryIndex *ImportSummary, @@ -367,12 +333,8 @@ bool lto::opt(const Config &Conf, TargetMachine *TM, unsigned Task, Module &Mod, /*Cmdline*/ CmdArgs); } // FIXME: Plumb the combined index into the new pass manager. - if (Conf.UseNewPM || !Conf.OptPipeline.empty()) { - runNewPMPasses(Conf, Mod, TM, Conf.OptLevel, IsThinLTO, ExportSummary, - ImportSummary); - } else { - runOldPMPasses(Conf, Mod, TM, IsThinLTO, ExportSummary, ImportSummary); - } + runNewPMPasses(Conf, Mod, TM, Conf.OptLevel, IsThinLTO, ExportSummary, + ImportSummary); return !Conf.PostOptModuleHook || Conf.PostOptModuleHook(Task, Mod); } -- 2.7.4