diff --git a/lib/IR/IRPrintingPasses.cpp b/lib/IR/IRPrintingPasses.cpp index befe1d9ffb1..43010220b9f 100644 --- a/lib/IR/IRPrintingPasses.cpp +++ b/lib/IR/IRPrintingPasses.cpp @@ -27,7 +27,8 @@ PrintModulePass::PrintModulePass(raw_ostream &OS, const std::string &Banner, ShouldPreserveUseListOrder(ShouldPreserveUseListOrder) {} PreservedAnalyses PrintModulePass::run(Module &M, ModuleAnalysisManager &) { - OS << Banner; + if (!Banner.empty()) + OS << Banner << "\n"; if (llvm::isFunctionInPrintList("*")) M.print(OS, nullptr, ShouldPreserveUseListOrder); else { diff --git a/test/Other/2010-05-06-Printer.ll b/test/Other/2010-05-06-Printer.ll index dcc0e752bb5..9e7c9cb6ab4 100644 --- a/test/Other/2010-05-06-Printer.ll +++ b/test/Other/2010-05-06-Printer.ll @@ -10,10 +10,12 @@ define void @foo(){ ret void } +;ALL-NOT: IR Dump After {{.*}}; ModuleID = ;ALL: define void @tester() ;ALL: define void @foo() ;ALL: ModuleID = ;FOO: IR Dump After +;FOO-EMPTY: ;FOO-NEXT: define void @foo() ;FOO-NOT: define void @tester