diff options
author | Dehao Chen <dehao@google.com> | 2017-08-02 03:03:19 +0000 |
---|---|---|
committer | Dehao Chen <dehao@google.com> | 2017-08-02 03:03:19 +0000 |
commit | 3246dc3df1b9aaabd62e0542033fb67e50da311a (patch) | |
tree | bae3932e9b05767cc35a077f41b5dd68def1d2da /llvm | |
parent | a350f656a5a870b7ccf31fe89f8aed79606c0b2c (diff) | |
download | bcm5719-llvm-3246dc3df1b9aaabd62e0542033fb67e50da311a.tar.gz bcm5719-llvm-3246dc3df1b9aaabd62e0542033fb67e50da311a.zip |
Fix the bug that parseAAPipeline is not invoked in runNewPMPasses in release compiler.
Summary: The logic is guarded by "assert".
Reviewers: davidxl, davide, chandlerc
Reviewed By: davide, chandlerc
Subscribers: sanjoy, llvm-commits, mehdi_amini
Differential Revision: https://reviews.llvm.org/D36195
llvm-svn: 309787
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/include/llvm/LTO/Config.h | 3 | ||||
-rw-r--r-- | llvm/lib/LTO/LTOBackend.cpp | 17 | ||||
-rw-r--r-- | llvm/test/tools/llvm-lto2/X86/pipeline.ll | 5 | ||||
-rw-r--r-- | llvm/tools/llvm-lto2/llvm-lto2.cpp | 6 |
4 files changed, 23 insertions, 8 deletions
diff --git a/llvm/include/llvm/LTO/Config.h b/llvm/include/llvm/LTO/Config.h index 73106f77ca5..8e9d0c76e7c 100644 --- a/llvm/include/llvm/LTO/Config.h +++ b/llvm/include/llvm/LTO/Config.h @@ -79,6 +79,9 @@ struct Config { /// Whether to emit optimization remarks with hotness informations. bool RemarksWithHotness = false; + /// Whether to emit the pass manager debuggging informations. + bool DebugPassManager = false; + bool ShouldDiscardValueNames = true; DiagnosticHandlerFunction DiagHandler; diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp index 6d1e37fa7e1..5c113212041 100644 --- a/llvm/lib/LTO/LTOBackend.cpp +++ b/llvm/lib/LTO/LTOBackend.cpp @@ -141,12 +141,13 @@ static void runNewPMPasses(Config &Conf, Module &Mod, TargetMachine *TM, AAManager AA; // Parse a custom AA pipeline if asked to. - assert(PB.parseAAPipeline(AA, "default")); + if (!PB.parseAAPipeline(AA, "default")) + report_fatal_error("Error parsing default AA pipeline"); - LoopAnalysisManager LAM; - FunctionAnalysisManager FAM; - CGSCCAnalysisManager CGAM; - ModuleAnalysisManager MAM; + LoopAnalysisManager LAM(Conf.DebugPassManager); + FunctionAnalysisManager FAM(Conf.DebugPassManager); + CGSCCAnalysisManager CGAM(Conf.DebugPassManager); + ModuleAnalysisManager MAM(Conf.DebugPassManager); // Register the AA manager first so that our version is the one used. FAM.registerPass([&] { return std::move(AA); }); @@ -158,7 +159,7 @@ static void runNewPMPasses(Config &Conf, Module &Mod, TargetMachine *TM, PB.registerLoopAnalyses(LAM); PB.crossRegisterProxies(LAM, FAM, CGAM, MAM); - ModulePassManager MPM; + ModulePassManager MPM(Conf.DebugPassManager); // FIXME (davide): verify the input. PassBuilder::OptimizationLevel OL; @@ -181,9 +182,9 @@ static void runNewPMPasses(Config &Conf, Module &Mod, TargetMachine *TM, } if (IsThinLTO) - MPM = PB.buildThinLTODefaultPipeline(OL, false /* DebugLogging */); + MPM = PB.buildThinLTODefaultPipeline(OL, Conf.DebugPassManager); else - MPM = PB.buildLTODefaultPipeline(OL, false /* DebugLogging */); + MPM = PB.buildLTODefaultPipeline(OL, Conf.DebugPassManager); MPM.run(Mod, MAM); // FIXME (davide): verify the output. diff --git a/llvm/test/tools/llvm-lto2/X86/pipeline.ll b/llvm/test/tools/llvm-lto2/X86/pipeline.ll index 7effb0c801b..29276d8d13a 100644 --- a/llvm/test/tools/llvm-lto2/X86/pipeline.ll +++ b/llvm/test/tools/llvm-lto2/X86/pipeline.ll @@ -1,5 +1,10 @@ ; RUN: llvm-as < %s > %t1.bc +; Try the default pipeline and check is BasicAA is invoked. +; RUN: llvm-lto2 run %t1.bc -o %t.o -r %t1.bc,patatino,px -debug-pass-manager \ +; RUN: -use-new-pm 2>&1 | FileCheck %s --check-prefix=DEFAULT +; DEFAULT: Running analysis: BasicAA on patatino + ; Try a custom pipeline ; RUN: llvm-lto2 run %t1.bc -o %t.o -save-temps \ ; RUN: -r %t1.bc,patatino,px -opt-pipeline loweratomic \ diff --git a/llvm/tools/llvm-lto2/llvm-lto2.cpp b/llvm/tools/llvm-lto2/llvm-lto2.cpp index da2703fd50a..5db441fff25 100644 --- a/llvm/tools/llvm-lto2/llvm-lto2.cpp +++ b/llvm/tools/llvm-lto2/llvm-lto2.cpp @@ -109,6 +109,10 @@ static cl::opt<bool> cl::desc("Run LTO passes using the new pass manager"), cl::init(false), cl::Hidden); +static cl::opt<bool> + DebugPassManager("debug-pass-manager", cl::init(false), cl::Hidden, + cl::desc("Print pass management debugging information")); + static void check(Error E, std::string Msg) { if (!E) return; @@ -195,6 +199,8 @@ static int run(int argc, char **argv) { Conf.RelocModel = *RM; Conf.CodeModel = CMModel; + Conf.DebugPassManager = DebugPassManager; + if (SaveTemps) check(Conf.addSaveTemps(OutputFilename + "."), "Config::addSaveTemps failed"); |