aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/opt
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/opt')
-rw-r--r--llvm/tools/opt/NewPMDriver.cpp16
-rw-r--r--llvm/tools/opt/NewPMDriver.h2
-rw-r--r--llvm/tools/opt/optdriver.cpp16
3 files changed, 15 insertions, 19 deletions
diff --git a/llvm/tools/opt/NewPMDriver.cpp b/llvm/tools/opt/NewPMDriver.cpp
index 374698083763..ea300fb3dbeb 100644
--- a/llvm/tools/opt/NewPMDriver.cpp
+++ b/llvm/tools/opt/NewPMDriver.cpp
@@ -227,10 +227,6 @@ static cl::opt<bool> DisableLoopUnrolling(
"disable-loop-unrolling",
cl::desc("Disable loop unrolling in all relevant passes"), cl::init(false));
-namespace llvm {
-extern cl::opt<bool> PrintPipelinePasses;
-} // namespace llvm
-
template <typename PassManagerT>
bool tryParsePipelineText(PassBuilder &PB,
const cl::opt<std::string> &PipelineOpt) {
@@ -298,19 +294,19 @@ static void registerEPCallbacks(PassBuilder &PB) {
if (tryParsePipelineText<ModulePassManager>(
PB, PipelineEarlySimplificationEPPipeline))
PB.registerPipelineEarlySimplificationEPCallback(
- [&PB](ModulePassManager &PM, OptimizationLevel) {
+ [&PB](ModulePassManager &PM, OptimizationLevel, ThinOrFullLTOPhase) {
ExitOnError Err("Unable to parse EarlySimplification pipeline: ");
Err(PB.parsePassPipeline(PM, PipelineEarlySimplificationEPPipeline));
});
if (tryParsePipelineText<ModulePassManager>(PB, OptimizerEarlyEPPipeline))
PB.registerOptimizerEarlyEPCallback(
- [&PB](ModulePassManager &PM, OptimizationLevel) {
+ [&PB](ModulePassManager &PM, OptimizationLevel, ThinOrFullLTOPhase) {
ExitOnError Err("Unable to parse OptimizerEarlyEP pipeline: ");
Err(PB.parsePassPipeline(PM, OptimizerEarlyEPPipeline));
});
if (tryParsePipelineText<ModulePassManager>(PB, OptimizerLastEPPipeline))
PB.registerOptimizerLastEPCallback(
- [&PB](ModulePassManager &PM, OptimizationLevel) {
+ [&PB](ModulePassManager &PM, OptimizationLevel, ThinOrFullLTOPhase) {
ExitOnError Err("Unable to parse OptimizerLastEP pipeline: ");
Err(PB.parsePassPipeline(PM, OptimizerLastEPPipeline));
});
@@ -347,8 +343,6 @@ bool llvm::runPassPipeline(
bool ShouldPreserveBitcodeUseListOrder, bool EmitSummaryIndex,
bool EmitModuleHash, bool EnableDebugify, bool VerifyDIPreserve,
bool UnifiedLTO) {
- bool VerifyEachPass = VK == VK_VerifyEachPass;
-
auto FS = vfs::getRealFileSystem();
std::optional<PGOOptions> P;
switch (PGOKindFlag) {
@@ -414,7 +408,7 @@ bool llvm::runPassPipeline(
PrintPassOpts.Verbose = DebugPM == DebugLogging::Verbose;
PrintPassOpts.SkipAnalyses = DebugPM == DebugLogging::Quiet;
StandardInstrumentations SI(M.getContext(), DebugPM != DebugLogging::None,
- VerifyEachPass, PrintPassOpts);
+ VK == VerifierKind::EachPass, PrintPassOpts);
SI.registerCallbacks(PIC, &MAM);
DebugifyEachInstrumentation Debugify;
DebugifyStatsMap DIStatsMap;
@@ -487,7 +481,7 @@ bool llvm::runPassPipeline(
}
}
- if (VK > VK_NoVerifier)
+ if (VK != VerifierKind::None)
MPM.addPass(VerifierPass());
if (EnableDebugify)
MPM.addPass(NewPMCheckDebugifyPass(false, "", &DIStatsMap));
diff --git a/llvm/tools/opt/NewPMDriver.h b/llvm/tools/opt/NewPMDriver.h
index 19cabd15436e..2daae571e72c 100644
--- a/llvm/tools/opt/NewPMDriver.h
+++ b/llvm/tools/opt/NewPMDriver.h
@@ -44,7 +44,7 @@ enum OutputKind {
OK_OutputBitcode,
OK_OutputThinLTOBitcode,
};
-enum VerifierKind { VK_NoVerifier, VK_VerifyOut, VK_VerifyEachPass };
+enum class VerifierKind { None, InputOutput, EachPass };
enum PGOKind {
NoPGO,
InstrGen,
diff --git a/llvm/tools/opt/optdriver.cpp b/llvm/tools/opt/optdriver.cpp
index b26aeb061851..8ef249e1708b 100644
--- a/llvm/tools/opt/optdriver.cpp
+++ b/llvm/tools/opt/optdriver.cpp
@@ -375,6 +375,7 @@ static bool shouldPinPassToLegacyPM(StringRef Pass) {
"fix-irreducible",
"expand-large-fp-convert",
"callbrprepare",
+ "scalarizer",
};
for (const auto &P : PassNamePrefix)
if (Pass.starts_with(P))
@@ -443,7 +444,6 @@ extern "C" int optMain(
initializePostInlineEntryExitInstrumenterPass(Registry);
initializeUnreachableBlockElimLegacyPassPass(Registry);
initializeExpandReductionsPass(Registry);
- initializeExpandVectorPredicationPass(Registry);
initializeWasmEHPreparePass(Registry);
initializeWriteBitcodePassPass(Registry);
initializeReplaceWithVeclibLegacyPass(Registry);
@@ -727,11 +727,11 @@ extern "C" int optMain(
? OK_OutputAssembly
: (OutputThinLTOBC ? OK_OutputThinLTOBitcode : OK_OutputBitcode);
- VerifierKind VK = VK_VerifyOut;
+ VerifierKind VK = VerifierKind::InputOutput;
if (NoVerify)
- VK = VK_NoVerifier;
+ VK = VerifierKind::None;
else if (VerifyEach)
- VK = VK_VerifyEachPass;
+ VK = VerifierKind::EachPass;
// The user has asked to use the new pass manager and provided a pipeline
// string. Hand off the rest of the functionality to the new code for that
@@ -801,9 +801,11 @@ extern "C" int optMain(
}
if (TM) {
- // FIXME: We should dyn_cast this when supported.
- auto &LTM = static_cast<LLVMTargetMachine &>(*TM);
- Pass *TPC = LTM.createPassConfig(Passes);
+ Pass *TPC = TM->createPassConfig(Passes);
+ if (!TPC) {
+ errs() << "Target Machine pass config creation failed.\n";
+ return 1;
+ }
Passes.add(TPC);
}