Skip to content

Commit

Permalink
Revert "[LTO][Legacy] Add -debug-pass-manager option to enable pass r…
Browse files Browse the repository at this point in the history
…un/skip trace."

This reverts commit a60405c.
  • Loading branch information
Wael Yehia committed Sep 29, 2021
1 parent fb4e44c commit 8b8da01
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 29 deletions.
7 changes: 7 additions & 0 deletions llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ class ThinLTOCodeGenerator {
/// Enable or disable the new pass manager.
void setUseNewPM(unsigned Enabled) { UseNewPM = Enabled; }

/// Enable or disable debug output for the new pass manager.
void setDebugPassManager(unsigned Enabled) { DebugPassManager = Enabled; }

/// Disable CodeGen, only run the stages till codegen and stop. The output
/// will be bitcode.
void disableCodeGen(bool Disable) { DisableCodeGen = Disable; }
Expand Down Expand Up @@ -348,6 +351,10 @@ class ThinLTOCodeGenerator {
/// Flag to indicate whether the new pass manager should be used for IR
/// optimizations.
bool UseNewPM = LLVM_ENABLE_NEW_PASS_MANAGER;

/// Flag to indicate whether debug output should be enabled for the new pass
/// manager.
bool DebugPassManager = false;
};
}
#endif
6 changes: 0 additions & 6 deletions llvm/lib/LTO/LTO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@ cl::opt<bool> EnableLTOInternalization(
"enable-lto-internalization", cl::init(true), cl::Hidden,
cl::desc("Enable global value internalization in LTO"));

namespace llvm {
cl::opt<bool>
DebugPassManager("debug-pass-manager", cl::init(false), cl::Hidden,
cl::desc("Print pass management debugging information"));
}

// Computes a unique hash for the Module considering the current list of
// export/import and other global analysis results.
// The hash is produced in \p Key.
Expand Down
3 changes: 0 additions & 3 deletions llvm/lib/LTO/LTOCodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ cl::opt<std::string> LTOStatsFile(
"lto-stats-file",
cl::desc("Save statistics to the specified file"),
cl::Hidden);

extern cl::opt<bool> DebugPassManager;
}

LTOCodeGenerator::LTOCodeGenerator(LLVMContext &Context)
Expand All @@ -132,7 +130,6 @@ LTOCodeGenerator::LTOCodeGenerator(LLVMContext &Context)
Config.PreCodeGenPassesHook = [](legacy::PassManager &PM) {
PM.add(createObjCARCContractPass());
};
Config.DebugPassManager = DebugPassManager;
}

LTOCodeGenerator::~LTOCodeGenerator() {}
Expand Down
9 changes: 5 additions & 4 deletions llvm/lib/LTO/ThinLTOCodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ extern cl::opt<bool> RemarksWithHotness;
extern cl::opt<Optional<uint64_t>, false, remarks::HotnessThresholdParser>
RemarksHotnessThreshold;
extern cl::opt<std::string> RemarksFormat;
extern cl::opt<bool> DebugPassManager;
}

namespace {
Expand Down Expand Up @@ -270,6 +269,7 @@ static void optimizeModule(Module &TheModule, TargetMachine &TM,

static void optimizeModuleNewPM(Module &TheModule, TargetMachine &TM,
unsigned OptLevel, bool Freestanding,
bool DebugPassManager,
ModuleSummaryIndex *Index) {
Optional<PGOOptions> PGOOpt;
LoopAnalysisManager LAM;
Expand Down Expand Up @@ -489,7 +489,7 @@ ProcessThinLTOModule(Module &TheModule, ModuleSummaryIndex &Index,
const ThinLTOCodeGenerator::CachingOptions &CacheOptions,
bool DisableCodeGen, StringRef SaveTempsDir,
bool Freestanding, unsigned OptLevel, unsigned count,
bool UseNewPM) {
bool UseNewPM, bool DebugPassManager) {

// "Benchmark"-like optimization: single-source case
bool SingleModule = (ModuleMap.size() == 1);
Expand Down Expand Up @@ -530,7 +530,8 @@ ProcessThinLTOModule(Module &TheModule, ModuleSummaryIndex &Index,
}

if (UseNewPM)
optimizeModuleNewPM(TheModule, TM, OptLevel, Freestanding, &Index);
optimizeModuleNewPM(TheModule, TM, OptLevel, Freestanding, DebugPassManager,
&Index);
else
optimizeModule(TheModule, TM, OptLevel, Freestanding, &Index);

Expand Down Expand Up @@ -1218,7 +1219,7 @@ void ThinLTOCodeGenerator::run() {
ExportList, GUIDPreservedSymbols,
ModuleToDefinedGVSummaries[ModuleIdentifier], CacheOptions,
DisableCodeGen, SaveTempsDir, Freestanding, OptLevel, count,
UseNewPM);
UseNewPM, DebugPassManager);

// Commit to the cache (if enabled)
CacheEntry.write(*OutputBuffer);
Expand Down
12 changes: 0 additions & 12 deletions llvm/test/tools/llvm-lto/lto-passes.ll

This file was deleted.

6 changes: 6 additions & 0 deletions llvm/tools/llvm-lto/llvm-lto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ static cl::opt<bool> UseNewPM(
"use-new-pm", cl::desc("Run LTO passes using the new pass manager"),
cl::init(LLVM_ENABLE_NEW_PASS_MANAGER), cl::Hidden, cl::cat(LTOCategory));

static cl::opt<bool>
DebugPassManager("debug-pass-manager", cl::init(false), cl::Hidden,
cl::desc("Print pass management debugging information"),
cl::cat(LTOCategory));

namespace {

struct ModuleInfo {
Expand Down Expand Up @@ -599,6 +604,7 @@ class ThinLTOProcessing {
ThinGenerator.setCacheMaxSizeBytes(ThinLTOCacheMaxSizeBytes);
ThinGenerator.setFreestanding(EnableFreestanding);
ThinGenerator.setUseNewPM(UseNewPM);
ThinGenerator.setDebugPassManager(DebugPassManager);

// Add all the exported symbols to the table of symbols to preserve.
for (unsigned i = 0; i < ExportedSymbols.size(); ++i)
Expand Down
8 changes: 4 additions & 4 deletions llvm/tools/llvm-lto2/llvm-lto2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ static cl::opt<bool>
cl::desc("Run LTO passes using the new pass manager"),
cl::init(LLVM_ENABLE_NEW_PASS_MANAGER), cl::Hidden);

static cl::opt<bool>
DebugPassManager("debug-pass-manager", cl::init(false), cl::Hidden,
cl::desc("Print pass management debugging information"));

static cl::opt<std::string>
StatsFile("stats-file", cl::desc("Filename to write statistics to"));

Expand All @@ -168,10 +172,6 @@ static void check(Error E, std::string Msg) {
exit(1);
}

namespace llvm {
extern cl::opt<bool> DebugPassManager;
}

template <typename T> static T check(Expected<T> E, std::string Msg) {
if (E)
return std::move(*E);
Expand Down

0 comments on commit 8b8da01

Please sign in to comment.