Skip to content

Commit

Permalink
Remove dump CFG support from legacy pass manager
Browse files Browse the repository at this point in the history
Upstream CFGPrinter support is being updated to remove legacy pass manager
support.

LGC only supports this option in legacy pass manager so removing the option
entirely. LGC now mostly uses the new pass manager, so the option is of limited
use and can only be enabled for backend passes anyway.
  • Loading branch information
dstutt committed Nov 29, 2023
1 parent 8e26731 commit 344e92f
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions lgc/util/PassManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ namespace cl {
// -verify-ir : verify the IR after each pass
static cl::opt<bool> VerifyIr("verify-ir", cl::desc("Verify IR after each pass"), cl::init(false));

// -dump-cfg-after : dump CFG as .dot files after specified pass
static cl::opt<std::string> DumpCfgAfter("dump-cfg-after", cl::desc("Dump CFG as .dot files after specified pass"),
cl::init(""));

// -dump-pass-name : dump executed pass name
static cl::opt<bool> DumpPassName("dump-pass-name", cl::desc("Dump executed pass name"), cl::init(false));

Expand Down Expand Up @@ -92,7 +88,6 @@ class LegacyPassManagerImpl final : public lgc::LegacyPassManager {

private:
bool m_stopped = false; // Whether we have already stopped adding new passes.
AnalysisID m_dumpCfgAfter = nullptr; // -dump-cfg-after pass id
AnalysisID m_printModule = nullptr; // Pass id of dump pass "Print Module IR"
unsigned *m_passIndex = nullptr; // Pass Index
};
Expand Down Expand Up @@ -200,9 +195,6 @@ std::unique_ptr<lgc::MbPassManager> lgc::MbPassManager::Create(TargetMachine *ta

// =====================================================================================================================
LegacyPassManagerImpl::LegacyPassManagerImpl() : LegacyPassManager() {
if (!cl::DumpCfgAfter.empty())
m_dumpCfgAfter = getPassIdFromName(cl::DumpCfgAfter);

m_printModule = getPassIdFromName("print-module");
}

Expand All @@ -216,8 +208,6 @@ PassManagerImpl::PassManagerImpl(TargetMachine *targetMachine, LLVMContext &cont
#endif
cl::DebugPassManager, cl::DebugPassManager || cl::VerifyIr,
/*PrintPassOpts=*/{true, false, true}) {
if (!cl::DumpCfgAfter.empty())
report_fatal_error("The --dump-cfg-after option is not supported with the new pass manager.");

auto &options = cl::getRegisteredOptions();

Expand All @@ -238,9 +228,6 @@ MbPassManagerImpl::MbPassManagerImpl(TargetMachine *targetMachine)
: MbPassManager(), m_targetMachine(targetMachine),
m_instrumentationStandard(cl::DebugPassManager, cl::DebugPassManager || cl::VerifyIr,
/*PrintPassOpts=*/{true, false, true}) {
if (!cl::DumpCfgAfter.empty())
report_fatal_error("The --dump-cfg-after option is not supported with the new pass manager.");

auto &options = cl::getRegisteredOptions();

auto it = options.find("stop-after");
Expand Down Expand Up @@ -410,11 +397,6 @@ void LegacyPassManagerImpl::add(Pass *pass) {
// Add a verify pass after it.
legacy::PassManager::add(createVerifierPass(true)); // FatalErrors=true
}

if (passId == m_dumpCfgAfter) {
// Add a CFG printer pass after it.
legacy::PassManager::add(createCFGPrinterLegacyPassPass());
}
}

// =====================================================================================================================
Expand Down

0 comments on commit 344e92f

Please sign in to comment.