Index: lib/IR/LegacyPassManager.cpp =================================================================== --- lib/IR/LegacyPassManager.cpp +++ lib/IR/LegacyPassManager.cpp @@ -100,13 +100,19 @@ /// This is a utility to check whether a pass should have IR dumped /// before it. static bool ShouldPrintBeforePass(const PassInfo *PI) { - return PrintBeforeAll || ShouldPrintBeforeOrAfterPass(PI, PrintBefore); + if (PrintBeforeAll && !(PI && PI->isAnalysis())) + return true; + return PI && !PI->isAnalysis() && + ShouldPrintBeforeOrAfterPass(PI, PrintBefore); } /// This is a utility to check whether a pass should have IR dumped /// after it. static bool ShouldPrintAfterPass(const PassInfo *PI) { - return PrintAfterAll || ShouldPrintBeforeOrAfterPass(PI, PrintAfter); + if (PrintAfterAll && !(PI && PI->isAnalysis())) + return true; + return PI && !PI->isAnalysis() && + ShouldPrintBeforeOrAfterPass(PI, PrintAfter); } /// isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions @@ -671,7 +677,7 @@ return; } - if (PI && !PI->isAnalysis() && ShouldPrintBeforePass(PI)) { + if (ShouldPrintBeforePass(PI)) { Pass *PP = P->createPrinterPass( dbgs(), std::string("*** IR Dump Before ") + P->getPassName() + " ***"); PP->assignPassManager(activeStack, getTopLevelPassManagerType()); @@ -680,7 +686,7 @@ // Add the requested pass to the best available pass manager. P->assignPassManager(activeStack, getTopLevelPassManagerType()); - if (PI && !PI->isAnalysis() && ShouldPrintAfterPass(PI)) { + if (ShouldPrintAfterPass(PI)) { Pass *PP = P->createPrinterPass( dbgs(), std::string("*** IR Dump After ") + P->getPassName() + " ***"); PP->assignPassManager(activeStack, getTopLevelPassManagerType());