/// 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; }
/// 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
"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.
"lto-stats-file",
cl::desc("Save statistics to the specified file"),
cl::Hidden);
-
-extern cl::opt<bool> DebugPassManager;
}
LTOCodeGenerator::LTOCodeGenerator(LLVMContext &Context)
Config.PreCodeGenPassesHook = [](legacy::PassManager &PM) {
PM.add(createObjCARCContractPass());
};
- Config.DebugPassManager = DebugPassManager;
}
LTOCodeGenerator::~LTOCodeGenerator() {}
extern cl::opt<Optional<uint64_t>, false, remarks::HotnessThresholdParser>
RemarksHotnessThreshold;
extern cl::opt<std::string> RemarksFormat;
-extern cl::opt<bool> DebugPassManager;
}
namespace {
static void optimizeModuleNewPM(Module &TheModule, TargetMachine &TM,
unsigned OptLevel, bool Freestanding,
+ bool DebugPassManager,
ModuleSummaryIndex *Index) {
Optional<PGOOptions> PGOOpt;
LoopAnalysisManager LAM;
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);
}
if (UseNewPM)
- optimizeModuleNewPM(TheModule, TM, OptLevel, Freestanding, &Index);
+ optimizeModuleNewPM(TheModule, TM, OptLevel, Freestanding, DebugPassManager,
+ &Index);
else
optimizeModule(TheModule, TM, OptLevel, Freestanding, &Index);
ExportList, GUIDPreservedSymbols,
ModuleToDefinedGVSummaries[ModuleIdentifier], CacheOptions,
DisableCodeGen, SaveTempsDir, Freestanding, OptLevel, count,
- UseNewPM);
+ UseNewPM, DebugPassManager);
// Commit to the cache (if enabled)
CacheEntry.write(*OutputBuffer);
+++ /dev/null
-; Test that -debug-pass-manager works in LTOCodeGenerator. The actual list of
-; passes that is run during LTO is tested in:
-; llvm/test/Other/new-pm-lto-defaults.ll
-;
-; RUN: llvm-as < %s > %t.bc
-; RUN: llvm-lto %t.bc -O0 --debug-pass-manager 2>&1 | FileCheck %s
-; CHECK: Running pass: WholeProgramDevirtPass
-
-define i32 @main() {
-entry:
- ret i32 42
-}
"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 {
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)
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"));
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);