aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorArthur Eubanks <aeubanks@google.com>2020-10-29 15:43:31 -0700
committerArthur Eubanks <aeubanks@google.com>2020-10-30 10:03:59 -0700
commit2e31727a884affa11f2955ddfa40590715f144df (patch)
treef4bdda1894aa9e5450f58a86d9e82cf3e6c6e8ae /llvm/lib
parent10f2a0d662d8d72eaac48d3e9b31ca8dc90df5a4 (diff)
downloadllvm-2e31727a884affa11f2955ddfa40590715f144df.zip
llvm-2e31727a884affa11f2955ddfa40590715f144df.tar.gz
llvm-2e31727a884affa11f2955ddfa40590715f144df.tar.bz2
[NFC] Clean up PassBuilder
Make DebugLogging a member variable so that users of PassBuilder don't need to pass it around so much. Move call to TargetMachine::registerPassBuilderCallbacks() within PassBuilder so users don't need to remember to call it. Reviewed By: asbirlea Differential Revision: https://reviews.llvm.org/D90437
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/LTO/LTOBackend.cpp11
-rw-r--r--llvm/lib/Passes/PassBuilder.cpp182
-rw-r--r--llvm/lib/Passes/PassRegistry.def4
3 files changed, 89 insertions, 108 deletions
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp
index 7f437a2..635584a 100644
--- a/llvm/lib/LTO/LTOBackend.cpp
+++ b/llvm/lib/LTO/LTOBackend.cpp
@@ -223,7 +223,7 @@ static void runNewPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM,
PassInstrumentationCallbacks PIC;
StandardInstrumentations SI(Conf.DebugPassManager);
SI.registerCallbacks(PIC);
- PassBuilder PB(TM, Conf.PTO, PGOOpt, &PIC);
+ PassBuilder PB(Conf.DebugPassManager, TM, Conf.PTO, PGOOpt, &PIC);
AAManager AA;
// Parse a custom AA pipeline if asked to.
@@ -270,10 +270,9 @@ static void runNewPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM,
}
if (IsThinLTO)
- MPM = PB.buildThinLTODefaultPipeline(OL, Conf.DebugPassManager,
- ImportSummary);
+ MPM = PB.buildThinLTODefaultPipeline(OL, ImportSummary);
else
- MPM = PB.buildLTODefaultPipeline(OL, Conf.DebugPassManager, ExportSummary);
+ MPM = PB.buildLTODefaultPipeline(OL, ExportSummary);
MPM.run(Mod, MAM);
// FIXME (davide): verify the output.
@@ -283,7 +282,7 @@ static void runNewPMCustomPasses(const Config &Conf, Module &Mod,
TargetMachine *TM, std::string PipelineDesc,
std::string AAPipelineDesc,
bool DisableVerify) {
- PassBuilder PB(TM);
+ PassBuilder PB(Conf.DebugPassManager, TM);
AAManager AA;
// Parse a custom AA pipeline if asked to.
@@ -722,4 +721,4 @@ bool lto::loadReferencedModules(
OwnedImportsLifetimeManager.push_back(std::move(*MBOrErr));
}
return true;
-} \ No newline at end of file
+}
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index 15a6b5e..719ad83 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -431,6 +431,14 @@ AnalysisKey NoOpLoopAnalysis::Key;
} // namespace
+PassBuilder::PassBuilder(bool DebugLogging, TargetMachine *TM,
+ PipelineTuningOptions PTO, Optional<PGOOptions> PGOOpt,
+ PassInstrumentationCallbacks *PIC)
+ : DebugLogging(DebugLogging), TM(TM), PTO(PTO), PGOOpt(PGOOpt), PIC(PIC) {
+ if (TM)
+ TM->registerPassBuilderCallbacks(*this, DebugLogging);
+}
+
void PassBuilder::invokePeepholeEPCallbacks(
FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) {
for (auto &C : PeepholeEPCallbacks)
@@ -474,8 +482,9 @@ void PassBuilder::registerLoopAnalyses(LoopAnalysisManager &LAM) {
}
// TODO: Investigate the cost/benefit of tail call elimination on debugging.
-FunctionPassManager PassBuilder::buildO1FunctionSimplificationPipeline(
- OptimizationLevel Level, ThinLTOPhase Phase, bool DebugLogging) {
+FunctionPassManager
+PassBuilder::buildO1FunctionSimplificationPipeline(OptimizationLevel Level,
+ ThinLTOPhase Phase) {
FunctionPassManager FPM(DebugLogging);
@@ -600,14 +609,13 @@ FunctionPassManager PassBuilder::buildO1FunctionSimplificationPipeline(
FunctionPassManager
PassBuilder::buildFunctionSimplificationPipeline(OptimizationLevel Level,
- ThinLTOPhase Phase,
- bool DebugLogging) {
+ ThinLTOPhase Phase) {
assert(Level != OptimizationLevel::O0 && "Must request optimizations!");
// The O1 pipeline has a separate pipeline creation function to simplify
// construction readability.
if (Level.getSpeedupLevel() == 1)
- return buildO1FunctionSimplificationPipeline(Level, Phase, DebugLogging);
+ return buildO1FunctionSimplificationPipeline(Level, Phase);
FunctionPassManager FPM(DebugLogging);
@@ -784,7 +792,7 @@ PassBuilder::buildFunctionSimplificationPipeline(OptimizationLevel Level,
return FPM;
}
-void PassBuilder::addPGOInstrPasses(ModulePassManager &MPM, bool DebugLogging,
+void PassBuilder::addPGOInstrPasses(ModulePassManager &MPM,
PassBuilder::OptimizationLevel Level,
bool RunProfileGen, bool IsCS,
std::string ProfileFile,
@@ -854,8 +862,8 @@ void PassBuilder::addPGOInstrPasses(ModulePassManager &MPM, bool DebugLogging,
}
void PassBuilder::addPGOInstrPassesForO0(ModulePassManager &MPM,
- bool DebugLogging, bool RunProfileGen,
- bool IsCS, std::string ProfileFile,
+ bool RunProfileGen, bool IsCS,
+ std::string ProfileFile,
std::string ProfileRemappingFile) {
if (!RunProfileGen) {
assert(!ProfileFile.empty() && "Profile use expecting a profile file!");
@@ -884,8 +892,7 @@ getInlineParamsFromOptLevel(PassBuilder::OptimizationLevel Level) {
}
ModuleInlinerWrapperPass
-PassBuilder::buildInlinerPipeline(OptimizationLevel Level, ThinLTOPhase Phase,
- bool DebugLogging) {
+PassBuilder::buildInlinerPipeline(OptimizationLevel Level, ThinLTOPhase Phase) {
InlineParams IP = getInlineParamsFromOptLevel(Level);
if (Phase == PassBuilder::ThinLTOPhase::PreLink && PGOOpt &&
PGOOpt->Action == PGOOptions::SampleUse)
@@ -938,7 +945,7 @@ PassBuilder::buildInlinerPipeline(OptimizationLevel Level, ThinLTOPhase Phase,
// Lastly, add the core function simplification pipeline nested inside the
// CGSCC walk.
MainCGPipeline.addPass(createCGSCCToFunctionPassAdaptor(
- buildFunctionSimplificationPipeline(Level, Phase, DebugLogging)));
+ buildFunctionSimplificationPipeline(Level, Phase)));
for (auto &C : CGSCCOptimizerLateEPCallbacks)
C(MainCGPipeline, Level);
@@ -946,8 +953,9 @@ PassBuilder::buildInlinerPipeline(OptimizationLevel Level, ThinLTOPhase Phase,
return MIWP;
}
-ModulePassManager PassBuilder::buildModuleSimplificationPipeline(
- OptimizationLevel Level, ThinLTOPhase Phase, bool DebugLogging) {
+ModulePassManager
+PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
+ ThinLTOPhase Phase) {
ModulePassManager MPM(DebugLogging);
bool HasSampleProfile = PGOOpt && (PGOOpt->Action == PGOOptions::SampleUse);
@@ -1068,7 +1076,7 @@ ModulePassManager PassBuilder::buildModuleSimplificationPipeline(
if (PGOOpt && Phase != ThinLTOPhase::PostLink &&
(PGOOpt->Action == PGOOptions::IRInstr ||
PGOOpt->Action == PGOOptions::IRUse)) {
- addPGOInstrPasses(MPM, DebugLogging, Level,
+ addPGOInstrPasses(MPM, Level,
/* RunProfileGen */ PGOOpt->Action == PGOOptions::IRInstr,
/* IsCS */ false, PGOOpt->ProfileFile,
PGOOpt->ProfileRemappingFile);
@@ -1082,7 +1090,7 @@ ModulePassManager PassBuilder::buildModuleSimplificationPipeline(
if (EnableSyntheticCounts && !PGOOpt)
MPM.addPass(SyntheticCountsPropagation());
- MPM.addPass(buildInlinerPipeline(Level, Phase, DebugLogging));
+ MPM.addPass(buildInlinerPipeline(Level, Phase));
if (EnableMemProfiler && Phase != ThinLTOPhase::PreLink) {
MPM.addPass(createModuleToFunctionPassAdaptor(MemProfilerPass()));
@@ -1092,8 +1100,9 @@ ModulePassManager PassBuilder::buildModuleSimplificationPipeline(
return MPM;
}
-ModulePassManager PassBuilder::buildModuleOptimizationPipeline(
- OptimizationLevel Level, bool DebugLogging, bool LTOPreLink) {
+ModulePassManager
+PassBuilder::buildModuleOptimizationPipeline(OptimizationLevel Level,
+ bool LTOPreLink) {
ModulePassManager MPM(DebugLogging);
// Optimize globals now that the module is fully simplified.
@@ -1131,11 +1140,11 @@ ModulePassManager PassBuilder::buildModuleOptimizationPipeline(
// instrumentation is after all the inlines are done.
if (!LTOPreLink && PGOOpt) {
if (PGOOpt->CSAction == PGOOptions::CSIRInstr)
- addPGOInstrPasses(MPM, DebugLogging, Level, /* RunProfileGen */ true,
+ addPGOInstrPasses(MPM, Level, /* RunProfileGen */ true,
/* IsCS */ true, PGOOpt->CSProfileGenFile,
PGOOpt->ProfileRemappingFile);
else if (PGOOpt->CSAction == PGOOptions::CSIRUse)
- addPGOInstrPasses(MPM, DebugLogging, Level, /* RunProfileGen */ false,
+ addPGOInstrPasses(MPM, Level, /* RunProfileGen */ false,
/* IsCS */ true, PGOOpt->ProfileFile,
PGOOpt->ProfileRemappingFile);
}
@@ -1298,7 +1307,7 @@ ModulePassManager PassBuilder::buildModuleOptimizationPipeline(
ModulePassManager
PassBuilder::buildPerModuleDefaultPipeline(OptimizationLevel Level,
- bool DebugLogging, bool LTOPreLink) {
+ bool LTOPreLink) {
assert(Level != OptimizationLevel::O0 &&
"Must request optimizations for the default pipeline!");
@@ -1315,18 +1324,16 @@ PassBuilder::buildPerModuleDefaultPipeline(OptimizationLevel Level,
MPM.addPass(createModuleToFunctionPassAdaptor(AddDiscriminatorsPass()));
// Add the core simplification pipeline.
- MPM.addPass(buildModuleSimplificationPipeline(Level, ThinLTOPhase::None,
- DebugLogging));
+ MPM.addPass(buildModuleSimplificationPipeline(Level, ThinLTOPhase::None));
// Now add the optimization pipeline.
- MPM.addPass(buildModuleOptimizationPipeline(Level, DebugLogging, LTOPreLink));
+ MPM.addPass(buildModuleOptimizationPipeline(Level, LTOPreLink));
return MPM;
}
ModulePassManager
-PassBuilder::buildThinLTOPreLinkDefaultPipeline(OptimizationLevel Level,
- bool DebugLogging) {
+PassBuilder::buildThinLTOPreLinkDefaultPipeline(OptimizationLevel Level) {
assert(Level != OptimizationLevel::O0 &&
"Must request optimizations for the default pipeline!");
@@ -1345,8 +1352,7 @@ PassBuilder::buildThinLTOPreLinkDefaultPipeline(OptimizationLevel Level,
// If we are planning to perform ThinLTO later, we don't bloat the code with
// unrolling/vectorization/... now. Just simplify the module as much as we
// can.
- MPM.addPass(buildModuleSimplificationPipeline(Level, ThinLTOPhase::PreLink,
- DebugLogging));
+ MPM.addPass(buildModuleSimplificationPipeline(Level, ThinLTOPhase::PreLink));
// Run partial inlining pass to partially inline functions that have
// large bodies.
@@ -1371,8 +1377,7 @@ PassBuilder::buildThinLTOPreLinkDefaultPipeline(OptimizationLevel Level,
}
ModulePassManager PassBuilder::buildThinLTODefaultPipeline(
- OptimizationLevel Level, bool DebugLogging,
- const ModuleSummaryIndex *ImportSummary) {
+ OptimizationLevel Level, const ModuleSummaryIndex *ImportSummary) {
ModulePassManager MPM(DebugLogging);
if (ImportSummary) {
@@ -1402,27 +1407,25 @@ ModulePassManager PassBuilder::buildThinLTODefaultPipeline(
MPM.addPass(ForceFunctionAttrsPass());
// Add the core simplification pipeline.
- MPM.addPass(buildModuleSimplificationPipeline(Level, ThinLTOPhase::PostLink,
- DebugLogging));
+ MPM.addPass(buildModuleSimplificationPipeline(Level, ThinLTOPhase::PostLink));
// Now add the optimization pipeline.
- MPM.addPass(buildModuleOptimizationPipeline(Level, DebugLogging));
+ MPM.addPass(buildModuleOptimizationPipeline(Level));
return MPM;
}
ModulePassManager
-PassBuilder::buildLTOPreLinkDefaultPipeline(OptimizationLevel Level,
- bool DebugLogging) {
+PassBuilder::buildLTOPreLinkDefaultPipeline(OptimizationLevel Level) {
assert(Level != OptimizationLevel::O0 &&
"Must request optimizations for the default pipeline!");
// FIXME: We should use a customized pre-link pipeline!
- return buildPerModuleDefaultPipeline(Level, DebugLogging,
+ return buildPerModuleDefaultPipeline(Level,
/* LTOPreLink */ true);
}
ModulePassManager
-PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level, bool DebugLogging,
+PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level,
ModuleSummaryIndex *ExportSummary) {
ModulePassManager MPM(DebugLogging);
@@ -1558,11 +1561,11 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level, bool DebugLogging,
// sensitive PGO pass.
if (PGOOpt) {
if (PGOOpt->CSAction == PGOOptions::CSIRInstr)
- addPGOInstrPasses(MPM, DebugLogging, Level, /* RunProfileGen */ true,
+ addPGOInstrPasses(MPM, Level, /* RunProfileGen */ true,
/* IsCS */ true, PGOOpt->CSProfileGenFile,
PGOOpt->ProfileRemappingFile);
else if (PGOOpt->CSAction == PGOOptions::CSIRUse)
- addPGOInstrPasses(MPM, DebugLogging, Level, /* RunProfileGen */ false,
+ addPGOInstrPasses(MPM, Level, /* RunProfileGen */ false,
/* IsCS */ true, PGOOpt->ProfileFile,
PGOOpt->ProfileRemappingFile);
}
@@ -2149,8 +2152,7 @@ PassBuilder::parsePipelineText(StringRef Text) {
}
Error PassBuilder::parseModulePass(ModulePassManager &MPM,
- const PipelineElement &E,
- bool DebugLogging) {
+ const PipelineElement &E) {
auto &Name = E.Name;
auto &InnerPipeline = E.InnerPipeline;
@@ -2158,31 +2160,28 @@ Error PassBuilder::parseModulePass(ModulePassManager &MPM,
if (!InnerPipeline.empty()) {
if (Name == "module") {
ModulePassManager NestedMPM(DebugLogging);
- if (auto Err =
- parseModulePassPipeline(NestedMPM, InnerPipeline, DebugLogging))
+ if (auto Err = parseModulePassPipeline(NestedMPM, InnerPipeline))
return Err;
MPM.addPass(std::move(NestedMPM));
return Error::success();
}
if (Name == "cgscc") {
CGSCCPassManager CGPM(DebugLogging);
- if (auto Err = parseCGSCCPassPipeline(CGPM, InnerPipeline, DebugLogging))
+ if (auto Err = parseCGSCCPassPipeline(CGPM, InnerPipeline))
return Err;
MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(CGPM)));
return Error::success();
}
if (Name == "function") {
FunctionPassManager FPM(DebugLogging);
- if (auto Err =
- parseFunctionPassPipeline(FPM, InnerPipeline, DebugLogging))
+ if (auto Err = parseFunctionPassPipeline(FPM, InnerPipeline))
return Err;
MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
return Error::success();
}
if (auto Count = parseRepeatPassName(Name)) {
ModulePassManager NestedMPM(DebugLogging);
- if (auto Err =
- parseModulePassPipeline(NestedMPM, InnerPipeline, DebugLogging))
+ if (auto Err = parseModulePassPipeline(NestedMPM, InnerPipeline))
return Err;
MPM.addPass(createRepeatedPass(*Count, std::move(NestedMPM)));
return Error::success();
@@ -2222,7 +2221,7 @@ Error PassBuilder::parseModulePass(ModulePassManager &MPM,
(PGOOpt->Action == PGOOptions::IRInstr ||
PGOOpt->Action == PGOOptions::IRUse))
addPGOInstrPassesForO0(
- MPM, DebugLogging,
+ MPM,
/* RunProfileGen */ (PGOOpt->Action == PGOOptions::IRInstr),
/* IsCS */ false, PGOOpt->ProfileFile,
PGOOpt->ProfileRemappingFile);
@@ -2253,16 +2252,16 @@ Error PassBuilder::parseModulePass(ModulePassManager &MPM,
L.getSpeedupLevel() > 1 && L != OptimizationLevel::Oz;
if (Matches[1] == "default") {
- MPM.addPass(buildPerModuleDefaultPipeline(L, DebugLogging));
+ MPM.addPass(buildPerModuleDefaultPipeline(L));
} else if (Matches[1] == "thinlto-pre-link") {
- MPM.addPass(buildThinLTOPreLinkDefaultPipeline(L, DebugLogging));
+ MPM.addPass(buildThinLTOPreLinkDefaultPipeline(L));
} else if (Matches[1] == "thinlto") {
- MPM.addPass(buildThinLTODefaultPipeline(L, DebugLogging, nullptr));
+ MPM.addPass(buildThinLTODefaultPipeline(L, nullptr));
} else if (Matches[1] == "lto-pre-link") {
- MPM.addPass(buildLTOPreLinkDefaultPipeline(L, DebugLogging));
+ MPM.addPass(buildLTOPreLinkDefaultPipeline(L));
} else {
assert(Matches[1] == "lto" && "Not one of the matched options!");
- MPM.addPass(buildLTODefaultPipeline(L, DebugLogging, nullptr));
+ MPM.addPass(buildLTODefaultPipeline(L, nullptr));
}
return Error::success();
}
@@ -2331,7 +2330,7 @@ Error PassBuilder::parseModulePass(ModulePassManager &MPM,
}
Error PassBuilder::parseCGSCCPass(CGSCCPassManager &CGPM,
- const PipelineElement &E, bool DebugLogging) {
+ const PipelineElement &E) {
auto &Name = E.Name;
auto &InnerPipeline = E.InnerPipeline;
@@ -2339,8 +2338,7 @@ Error PassBuilder::parseCGSCCPass(CGSCCPassManager &CGPM,
if (!InnerPipeline.empty()) {
if (Name == "cgscc") {
CGSCCPassManager NestedCGPM(DebugLogging);
- if (auto Err =
- parseCGSCCPassPipeline(NestedCGPM, InnerPipeline, DebugLogging))
+ if (auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline))
return Err;
// Add the nested pass manager with the appropriate adaptor.
CGPM.addPass(std::move(NestedCGPM));
@@ -2348,8 +2346,7 @@ Error PassBuilder::parseCGSCCPass(CGSCCPassManager &CGPM,
}
if (Name == "function") {
FunctionPassManager FPM(DebugLogging);
- if (auto Err =
- parseFunctionPassPipeline(FPM, InnerPipeline, DebugLogging))
+ if (auto Err = parseFunctionPassPipeline(FPM, InnerPipeline))
return Err;
// Add the nested pass manager with the appropriate adaptor.
CGPM.addPass(createCGSCCToFunctionPassAdaptor(std::move(FPM)));
@@ -2357,16 +2354,14 @@ Error PassBuilder::parseCGSCCPass(CGSCCPassManager &CGPM,
}
if (auto Count = parseRepeatPassName(Name)) {
CGSCCPassManager NestedCGPM(DebugLogging);
- if (auto Err =
- parseCGSCCPassPipeline(NestedCGPM, InnerPipeline, DebugLogging))
+ if (auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline))
return Err;
CGPM.addPass(createRepeatedPass(*Count, std::move(NestedCGPM)));
return Error::success();
}
if (auto MaxRepetitions = parseDevirtPassName(Name)) {
CGSCCPassManager NestedCGPM(DebugLogging);
- if (auto Err =
- parseCGSCCPassPipeline(NestedCGPM, InnerPipeline, DebugLogging))
+ if (auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline))
return Err;
CGPM.addPass(
createDevirtSCCRepeatedPass(std::move(NestedCGPM), *MaxRepetitions));
@@ -2443,8 +2438,7 @@ Error PassBuilder::parseCGSCCPass(CGSCCPassManager &CGPM,
}
Error PassBuilder::parseFunctionPass(FunctionPassManager &FPM,
- const PipelineElement &E,
- bool DebugLogging) {
+ const PipelineElement &E) {
auto &Name = E.Name;
auto &InnerPipeline = E.InnerPipeline;
@@ -2452,8 +2446,7 @@ Error PassBuilder::parseFunctionPass(FunctionPassManager &FPM,
if (!InnerPipeline.empty()) {
if (Name == "function") {
FunctionPassManager NestedFPM(DebugLogging);
- if (auto Err =
- parseFunctionPassPipeline(NestedFPM, InnerPipeline, DebugLogging))
+ if (auto Err = parseFunctionPassPipeline(NestedFPM, InnerPipeline))
return Err;
// Add the nested pass manager with the appropriate adaptor.
FPM.addPass(std::move(NestedFPM));
@@ -2461,7 +2454,7 @@ Error PassBuilder::parseFunctionPass(FunctionPassManager &FPM,
}
if (Name == "loop" || Name == "loop-mssa") {
LoopPassManager LPM(DebugLogging);
- if (auto Err = parseLoopPassPipeline(LPM, InnerPipeline, DebugLogging))
+ if (auto Err = parseLoopPassPipeline(LPM, InnerPipeline))
return Err;
// Add the nested pass manager with the appropriate adaptor.
bool UseMemorySSA = (Name == "loop-mssa");
@@ -2474,8 +2467,7 @@ Error PassBuilder::parseFunctionPass(FunctionPassManager &FPM,
}
if (auto Count = parseRepeatPassName(Name)) {
FunctionPassManager NestedFPM(DebugLogging);
- if (auto Err =
- parseFunctionPassPipeline(NestedFPM, InnerPipeline, DebugLogging))
+ if (auto Err = parseFunctionPassPipeline(NestedFPM, InnerPipeline))
return Err;
FPM.addPass(createRepeatedPass(*Count, std::move(NestedFPM)));
return Error::success();
@@ -2546,8 +2538,8 @@ Error PassBuilder::parseFunctionPass(FunctionPassManager &FPM,
inconvertibleErrorCode());
}
-Error PassBuilder::parseLoopPass(LoopPassManager &LPM, const PipelineElement &E,
- bool DebugLogging) {
+Error PassBuilder::parseLoopPass(LoopPassManager &LPM,
+ const PipelineElement &E) {
StringRef Name = E.Name;
auto &InnerPipeline = E.InnerPipeline;
@@ -2555,8 +2547,7 @@ Error PassBuilder::parseLoopPass(LoopPassManager &LPM, const PipelineElement &E,
if (!InnerPipeline.empty()) {
if (Name == "loop") {
LoopPassManager NestedLPM(DebugLogging);
- if (auto Err =
- parseLoopPassPipeline(NestedLPM, InnerPipeline, DebugLogging))
+ if (auto Err = parseLoopPassPipeline(NestedLPM, InnerPipeline))
return Err;
// Add the nested pass manager with the appropriate adaptor.
LPM.addPass(std::move(NestedLPM));
@@ -2564,8 +2555,7 @@ Error PassBuilder::parseLoopPass(LoopPassManager &LPM, const PipelineElement &E,
}
if (auto Count = parseRepeatPassName(Name)) {
LoopPassManager NestedLPM(DebugLogging);
- if (auto Err =
- parseLoopPassPipeline(NestedLPM, InnerPipeline, DebugLogging))
+ if (auto Err = parseLoopPassPipeline(NestedLPM, InnerPipeline))
return Err;
LPM.addPass(createRepeatedPass(*Count, std::move(NestedLPM)));
return Error::success();
@@ -2639,30 +2629,27 @@ bool PassBuilder::parseAAPassName(AAManager &AA, StringRef Name) {
}
Error PassBuilder::parseLoopPassPipeline(LoopPassManager &LPM,
- ArrayRef<PipelineElement> Pipeline,
- bool DebugLogging) {
+ ArrayRef<PipelineElement> Pipeline) {
for (const auto &Element : Pipeline) {
- if (auto Err = parseLoopPass(LPM, Element, DebugLogging))
+ if (auto Err = parseLoopPass(LPM, Element))
return Err;
}
return Error::success();
}
-Error PassBuilder::parseFunctionPassPipeline(FunctionPassManager &FPM,
- ArrayRef<PipelineElement> Pipeline,
- bool DebugLogging) {
+Error PassBuilder::parseFunctionPassPipeline(
+ FunctionPassManager &FPM, ArrayRef<PipelineElement> Pipeline) {
for (const auto &Element : Pipeline) {
- if (auto Err = parseFunctionPass(FPM, Element, DebugLogging))
+ if (auto Err = parseFunctionPass(FPM, Element))
return Err;
}
return Error::success();
}
Error PassBuilder::parseCGSCCPassPipeline(CGSCCPassManager &CGPM,
- ArrayRef<PipelineElement> Pipeline,
- bool DebugLogging) {
+ ArrayRef<PipelineElement> Pipeline) {
for (const auto &Element : Pipeline) {
- if (auto Err = parseCGSCCPass(CGPM, Element, DebugLogging))
+ if (auto Err = parseCGSCCPass(CGPM, Element))
return Err;
}
return Error::success();
@@ -2682,10 +2669,9 @@ void PassBuilder::crossRegisterProxies(LoopAnalysisManager &LAM,
}
Error PassBuilder::parseModulePassPipeline(ModulePassManager &MPM,
- ArrayRef<PipelineElement> Pipeline,
- bool DebugLogging) {
+ ArrayRef<PipelineElement> Pipeline) {
for (const auto &Element : Pipeline) {
- if (auto Err = parseModulePass(MPM, Element, DebugLogging))
+ if (auto Err = parseModulePass(MPM, Element))
return Err;
}
return Error::success();
@@ -2695,8 +2681,7 @@ Error PassBuilder::parseModulePassPipeline(ModulePassManager &MPM,
// FIXME: Should this routine accept a TargetMachine or require the caller to
// pre-populate the analysis managers with target-specific stuff?
Error PassBuilder::parsePassPipeline(ModulePassManager &MPM,
- StringRef PipelineText,
- bool DebugLogging) {
+ StringRef PipelineText) {
auto Pipeline = parsePipelineText(PipelineText);
if (!Pipeline || Pipeline->empty())
return make_error<StringError>(
@@ -2730,15 +2715,14 @@ Error PassBuilder::parsePassPipeline(ModulePassManager &MPM,
}
}
- if (auto Err = parseModulePassPipeline(MPM, *Pipeline, DebugLogging))
+ if (auto Err = parseModulePassPipeline(MPM, *Pipeline))
return Err;
return Error::success();
}
// Primary pass pipeline description parsing routine for a \c CGSCCPassManager
Error PassBuilder::parsePassPipeline(CGSCCPassManager &CGPM,
- StringRef PipelineText,
- bool DebugLogging) {
+ StringRef PipelineText) {
auto Pipeline = parsePipelineText(PipelineText);
if (!Pipeline || Pipeline->empty())
return make_error<StringError>(
@@ -2753,7 +2737,7 @@ Error PassBuilder::parsePassPipeline(CGSCCPassManager &CGPM,
.str(),
inconvertibleErrorCode());
- if (auto Err = parseCGSCCPassPipeline(CGPM, *Pipeline, DebugLogging))
+ if (auto Err = parseCGSCCPassPipeline(CGPM, *Pipeline))
return Err;
return Error::success();
}
@@ -2761,8 +2745,7 @@ Error PassBuilder::parsePassPipeline(CGSCCPassManager &CGPM,
// Primary pass pipeline description parsing routine for a \c
// FunctionPassManager
Error PassBuilder::parsePassPipeline(FunctionPassManager &FPM,
- StringRef PipelineText,
- bool DebugLogging) {
+ StringRef PipelineText) {
auto Pipeline = parsePipelineText(PipelineText);
if (!Pipeline || Pipeline->empty())
return make_error<StringError>(
@@ -2777,22 +2760,21 @@ Error PassBuilder::parsePassPipeline(FunctionPassManager &FPM,
.str(),
inconvertibleErrorCode());
- if (auto Err = parseFunctionPassPipeline(FPM, *Pipeline, DebugLogging))
+ if (auto Err = parseFunctionPassPipeline(FPM, *Pipeline))
return Err;
return Error::success();
}
// Primary pass pipeline description parsing routine for a \c LoopPassManager
Error PassBuilder::parsePassPipeline(LoopPassManager &CGPM,
- StringRef PipelineText,
- bool DebugLogging) {
+ StringRef PipelineText) {
auto Pipeline = parsePipelineText(PipelineText);
if (!Pipeline || Pipeline->empty())
return make_error<StringError>(
formatv("invalid pipeline '{0}'", PipelineText).str(),
inconvertibleErrorCode());
- if (auto Err = parseLoopPassPipeline(CGPM, *Pipeline, DebugLogging))
+ if (auto Err = parseLoopPassPipeline(CGPM, *Pipeline))
return Err;
return Error::success();
diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def
index 538913c..fb31348 100644
--- a/llvm/lib/Passes/PassRegistry.def
+++ b/llvm/lib/Passes/PassRegistry.def
@@ -93,10 +93,10 @@ MODULE_PASS("rewrite-symbols", RewriteSymbolPass())
MODULE_PASS("rpo-function-attrs", ReversePostOrderFunctionAttrsPass())
MODULE_PASS("sample-profile", SampleProfileLoaderPass())
MODULE_PASS("scc-oz-module-inliner",
- buildInlinerPipeline(OptimizationLevel::Oz, ThinLTOPhase::None, DebugLogging))
+ buildInlinerPipeline(OptimizationLevel::Oz, ThinLTOPhase::None))
MODULE_PASS("loop-extract-single", LoopExtractorPass(1))
MODULE_PASS("oz-module-optimizer",
- buildModuleOptimizationPipeline(OptimizationLevel::Oz, DebugLogging, /*LTOPreLink*/false))
+ buildModuleOptimizationPipeline(OptimizationLevel::Oz, /*LTOPreLink*/false))
MODULE_PASS("strip", StripSymbolsPass())
MODULE_PASS("strip-dead-debug-info", StripDeadDebugInfoPass())
MODULE_PASS("strip-dead-prototypes", StripDeadPrototypesPass())