[llvm] ceadf6e - [ThinLTOCodeGenerator] Remove support for legacy PM
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 11 02:30:57 PDT 2022
Author: Nikita Popov
Date: 2022-04-11T11:30:50+02:00
New Revision: ceadf6ee619ce610b269459b129996c4ac7173cb
URL: https://github.com/llvm/llvm-project/commit/ceadf6ee619ce610b269459b129996c4ac7173cb
DIFF: https://github.com/llvm/llvm-project/commit/ceadf6ee619ce610b269459b129996c4ac7173cb.diff
LOG: [ThinLTOCodeGenerator] Remove support for legacy PM
All users of NewPM=false for the (legacy) ThinLTOCodeGenerator
have been removed, so we can remove this functionality entirely.
Added:
Modified:
llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
llvm/lib/LTO/ThinLTOCodeGenerator.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h b/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
index 5816f36013e0c..ab40d88af8c13 100644
--- a/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
+++ b/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
@@ -344,10 +344,6 @@ class ThinLTOCodeGenerator {
/// IR Optimization Level [0-3].
unsigned OptLevel = 3;
- /// Flag to indicate whether the new pass manager should be used for IR
- /// optimizations.
- bool UseNewPM = true;
-
/// Flag to indicate whether debug output should be enabled for the new pass
/// manager.
bool DebugPassManager = false;
diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
index 37e85b6af6ba1..640e6c8e0ee23 100644
--- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
@@ -30,7 +30,6 @@
#include "llvm/IR/DiagnosticPrinter.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/LLVMRemarkStreamer.h"
-#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IR/Mangler.h"
#include "llvm/IR/PassTimingInfo.h"
#include "llvm/IR/Verifier.h"
@@ -58,7 +57,6 @@
#include "llvm/Transforms/IPO/FunctionAttrs.h"
#include "llvm/Transforms/IPO/FunctionImport.h"
#include "llvm/Transforms/IPO/Internalize.h"
-#include "llvm/Transforms/IPO/PassManagerBuilder.h"
#include "llvm/Transforms/IPO/WholeProgramDevirt.h"
#include "llvm/Transforms/ObjCARC.h"
#include "llvm/Transforms/Utils/FunctionImportUtils.h"
@@ -239,38 +237,7 @@ crossImportIntoModule(Module &TheModule, const ModuleSummaryIndex &Index,
static void optimizeModule(Module &TheModule, TargetMachine &TM,
unsigned OptLevel, bool Freestanding,
- ModuleSummaryIndex *Index) {
- // Populate the PassManager
- PassManagerBuilder PMB;
- PMB.LibraryInfo = new TargetLibraryInfoImpl(TM.getTargetTriple());
- if (Freestanding)
- PMB.LibraryInfo->disableAllFunctions();
- PMB.Inliner = createFunctionInliningPass();
- // FIXME: should get it from the bitcode?
- PMB.OptLevel = OptLevel;
- PMB.LoopVectorize = true;
- PMB.SLPVectorize = true;
- // Already did this in verifyLoadedModule().
- PMB.VerifyInput = false;
- PMB.VerifyOutput = false;
- PMB.ImportSummary = Index;
-
- legacy::PassManager PM;
-
- // Add the TTI (required to inform the vectorizer about register size for
- // instance)
- PM.add(createTargetTransformInfoWrapperPass(TM.getTargetIRAnalysis()));
-
- // Add optimizations
- PMB.populateThinLTOPassManager(PM);
-
- PM.run(TheModule);
-}
-
-static void optimizeModuleNewPM(Module &TheModule, TargetMachine &TM,
- unsigned OptLevel, bool Freestanding,
- bool DebugPassManager,
- ModuleSummaryIndex *Index) {
+ bool DebugPassManager, ModuleSummaryIndex *Index) {
Optional<PGOOptions> PGOOpt;
LoopAnalysisManager LAM;
FunctionAnalysisManager FAM;
@@ -485,7 +452,7 @@ ProcessThinLTOModule(Module &TheModule, ModuleSummaryIndex &Index,
const ThinLTOCodeGenerator::CachingOptions &CacheOptions,
bool DisableCodeGen, StringRef SaveTempsDir,
bool Freestanding, unsigned OptLevel, unsigned count,
- bool UseNewPM, bool DebugPassManager) {
+ bool DebugPassManager) {
// "Benchmark"-like optimization: single-source case
bool SingleModule = (ModuleMap.size() == 1);
@@ -525,11 +492,8 @@ ProcessThinLTOModule(Module &TheModule, ModuleSummaryIndex &Index,
saveTempBitcode(TheModule, SaveTempsDir, count, ".3.imported.bc");
}
- if (UseNewPM)
- optimizeModuleNewPM(TheModule, TM, OptLevel, Freestanding, DebugPassManager,
- &Index);
- else
- optimizeModule(TheModule, TM, OptLevel, Freestanding, &Index);
+ optimizeModule(TheModule, TM, OptLevel, Freestanding, DebugPassManager,
+ &Index);
saveTempBitcode(TheModule, SaveTempsDir, count, ".4.opt.bc");
@@ -953,7 +917,7 @@ void ThinLTOCodeGenerator::optimize(Module &TheModule) {
// Optimize now
optimizeModule(TheModule, *TMBuilder.create(), OptLevel, Freestanding,
- nullptr);
+ DebugPassManager, nullptr);
}
/// Write out the generated object file, either from CacheEntryPath or from
@@ -1216,7 +1180,7 @@ void ThinLTOCodeGenerator::run() {
ExportList, GUIDPreservedSymbols,
ModuleToDefinedGVSummaries[ModuleIdentifier], CacheOptions,
DisableCodeGen, SaveTempsDir, Freestanding, OptLevel, count,
- UseNewPM, DebugPassManager);
+ DebugPassManager);
// Commit to the cache (if enabled)
CacheEntry.write(*OutputBuffer);
More information about the llvm-commits
mailing list