[llvm] b0e9797 - [PassInstrumentation] Remove excess newline for the new pass manager

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 28 17:22:57 PST 2019


Author: Fangrui Song
Date: 2019-11-28T17:20:17-08:00
New Revision: b0e979724f2679e4e6f5b824144ea89289bd6d56

URL: https://github.com/llvm/llvm-project/commit/b0e979724f2679e4e6f5b824144ea89289bd6d56
DIFF: https://github.com/llvm/llvm-project/commit/b0e979724f2679e4e6f5b824144ea89289bd6d56.diff

LOG: [PassInstrumentation] Remove excess newline for the new pass manager

This also removes excess newline for the legacy pass manager when -filter-print-funcs is specified.

Added: 
    

Modified: 
    llvm/lib/IR/AsmWriter.cpp
    llvm/lib/IR/IRPrintingPasses.cpp
    llvm/test/Other/2010-05-06-Printer.ll
    llvm/test/Other/printer.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 01989b97f7fa..f9d4b181f862 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -3400,9 +3400,6 @@ void AssemblyWriter::printTypeIdentities() {
 
 /// printFunction - Print all aspects of a function.
 void AssemblyWriter::printFunction(const Function *F) {
-  // Print out the return type and name.
-  Out << '\n';
-
   if (AnnotationWriter) AnnotationWriter->emitFunctionAnnot(F, Out);
 
   if (F->isMaterializable())

diff  --git a/llvm/lib/IR/IRPrintingPasses.cpp b/llvm/lib/IR/IRPrintingPasses.cpp
index 8fa97a3aecb7..03657ff8d9d4 100644
--- a/llvm/lib/IR/IRPrintingPasses.cpp
+++ b/llvm/lib/IR/IRPrintingPasses.cpp
@@ -57,7 +57,7 @@ PreservedAnalyses PrintFunctionPass::run(Function &F,
     if (forcePrintModuleIR())
       OS << Banner << " (function: " << F.getName() << ")\n" << *F.getParent();
     else
-      OS << Banner << static_cast<Value &>(F);
+      OS << Banner << '\n' << static_cast<Value &>(F);
   }
   return PreservedAnalyses::all();
 }

diff  --git a/llvm/test/Other/2010-05-06-Printer.ll b/llvm/test/Other/2010-05-06-Printer.ll
index 9e7c9cb6ab4a..decd977c3d21 100644
--- a/llvm/test/Other/2010-05-06-Printer.ll
+++ b/llvm/test/Other/2010-05-06-Printer.ll
@@ -16,6 +16,5 @@ define void @foo(){
 ;ALL: ModuleID =
 
 ;FOO: IR Dump After
-;FOO-EMPTY:
 ;FOO-NEXT: define void @foo()
 ;FOO-NOT: define void @tester

diff  --git a/llvm/test/Other/printer.ll b/llvm/test/Other/printer.ll
index 9785a17b2280..863376562855 100644
--- a/llvm/test/Other/printer.ll
+++ b/llvm/test/Other/printer.ll
@@ -1,5 +1,7 @@
-; RUN: opt -mem2reg -instcombine -print-after-all -disable-output < %s 2>&1 | FileCheck %s
-; RUN: opt -passes='mem2reg,instcombine' -print-after-all -disable-output < %s 2>&1 | FileCheck %s
+; RUN: opt -mem2reg -instcombine -print-after-all -disable-output < %s 2>&1 | \
+; RUN:   FileCheck --check-prefixes=CHECK,OLDPM %s --implicit-check-not='IR Dump'
+; RUN: opt -passes='mem2reg,instcombine' -print-after-all -disable-output < %s 2>&1 | \
+; RUN:   FileCheck --check-prefixes=CHECK,NEWPM %s --implicit-check-not='IR Dump'
 define void @tester(){
   ret void
 }
@@ -8,21 +10,14 @@ define void @foo(){
   ret void
 }
 
-;CHECK-NOT: IR Dump After PassManager
-;CHECK-NOT: IR Dump After ModuleToFunctionPassAdaptor
-;
-;CHECK:     *** IR Dump After {{Promote Memory to Register|PromotePass}}
-;CHECK:     define void @tester
-;CHECK-NOT: define void @foo
-;CHECK:     *** IR Dump After {{Combine redundant instructions|InstCombinePass}}
-;CHECK:     define void @tester
-;CHECK-NOT: define void @foo
-;CHECK:     *** IR Dump After {{Promote Memory to Register|PromotePass}}
-;CHECK:     define void @foo
-;CHECK-NOT: define void @tester
-;CHECK:     *** IR Dump After {{Combine redundant instructions|InstCombinePass}}
-;CHECK:     define void @foo
-;CHECK-NOT: define void @tester
-;CHECK:     *** IR Dump After {{Module Verifier|VerifierPass}}
-;
-;CHECK-NOT: IR Dump After Print Module IR
+; NEWPM:      *** IR Dump After VerifierPass
+; CHECK:      *** IR Dump After {{Promote Memory to Register|PromotePass}}
+; CHECK-NEXT: define void @tester
+; CHECK:      *** IR Dump After {{Combine redundant instructions|InstCombinePass}}
+; CHECK-NEXT: define void @tester
+; OLDPM:      *** IR Dump After Module Verifier
+; CHECK:      *** IR Dump After {{Promote Memory to Register|PromotePass}}
+; CHECK-NEXT: define void @foo
+; CHECK:      *** IR Dump After {{Combine redundant instructions|InstCombinePass}}
+; CHECK-NEXT: define void @foo
+; CHECK:      *** IR Dump After {{Module Verifier|VerifierPass}}


        


More information about the llvm-commits mailing list