[clang] 3573a90 - [PM] Show the pass argument in pre/post-pass IR dumps

Nicolas Guillemot via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 25 14:02:08 PST 2021


Author: Nicolas Guillemot
Date: 2021-02-25T14:02:00-08:00
New Revision: 3573a90b8aec082b8d7a1e2fc35f7103a0df7cb6

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

LOG: [PM] Show the pass argument in pre/post-pass IR dumps

This patch adds each pass' pass argument in the header for IR dumps.
For example:

Before:

```
    *** IR Dump Before InstructionSelect ***
```

After:

```
    *** IR Dump Before InstructionSelect (instruction-select) ***
```

The goal is to make it easier to know what argument to pass to
command line options like `debug-only` or `run-pass` to further
investigate a given pass.

Added: 
    

Modified: 
    clang/test/Misc/pr32207.c
    llvm/lib/IR/LegacyPassManager.cpp
    llvm/test/CodeGen/SystemZ/frame-26.mir
    llvm/test/Transforms/Inline/null-function.ll

Removed: 
    


################################################################################
diff  --git a/clang/test/Misc/pr32207.c b/clang/test/Misc/pr32207.c
index 07a8815c4cac..dccec03d8cc7 100644
--- a/clang/test/Misc/pr32207.c
+++ b/clang/test/Misc/pr32207.c
@@ -1,4 +1,4 @@
 // test for r305179
 // RUN: %clang_cc1 -emit-llvm -O2 -fno-experimental-new-pass-manager -mllvm -print-after-all %s -o %t 2>&1 | FileCheck %s
-// CHECK: *** IR Dump After Function Integration/Inlining ***
+// CHECK: *** IR Dump After Function Integration/Inlining (inline) ***
 void foo() {}

diff  --git a/llvm/lib/IR/LegacyPassManager.cpp b/llvm/lib/IR/LegacyPassManager.cpp
index a1dae5bd572e..19b03dfc35cf 100644
--- a/llvm/lib/IR/LegacyPassManager.cpp
+++ b/llvm/lib/IR/LegacyPassManager.cpp
@@ -745,8 +745,10 @@ void PMTopLevelManager::schedulePass(Pass *P) {
   }
 
   if (PI && !PI->isAnalysis() && shouldPrintBeforePass(PI->getPassArgument())) {
-    Pass *PP = P->createPrinterPass(
-        dbgs(), ("*** IR Dump Before " + P->getPassName() + " ***").str());
+    Pass *PP =
+        P->createPrinterPass(dbgs(), ("*** IR Dump Before " + P->getPassName() +
+                                      " (" + PI->getPassArgument() + ") ***")
+                                         .str());
     PP->assignPassManager(activeStack, getTopLevelPassManagerType());
   }
 
@@ -754,8 +756,10 @@ void PMTopLevelManager::schedulePass(Pass *P) {
   P->assignPassManager(activeStack, getTopLevelPassManagerType());
 
   if (PI && !PI->isAnalysis() && shouldPrintAfterPass(PI->getPassArgument())) {
-    Pass *PP = P->createPrinterPass(
-        dbgs(), ("*** IR Dump After " + P->getPassName() + " ***").str());
+    Pass *PP =
+        P->createPrinterPass(dbgs(), ("*** IR Dump After " + P->getPassName() +
+                                      " (" + PI->getPassArgument() + ") ***")
+                                         .str());
     PP->assignPassManager(activeStack, getTopLevelPassManagerType());
   }
 }

diff  --git a/llvm/test/CodeGen/SystemZ/frame-26.mir b/llvm/test/CodeGen/SystemZ/frame-26.mir
index e4ff1bd3dcb6..ce438a2919db 100644
--- a/llvm/test/CodeGen/SystemZ/frame-26.mir
+++ b/llvm/test/CodeGen/SystemZ/frame-26.mir
@@ -5,7 +5,7 @@
 # Test that R6 when used for an argument is modelled as being live throughout
 # the function when not saved in the prologue..
 
-# CHECK:      # *** IR Dump After Prologue/Epilogue Insertion & Frame Finalization ***:
+# CHECK:      # *** IR Dump After Prologue/Epilogue Insertion & Frame Finalization (prologepilog) ***:
 # CHECK-NEXT: # Machine code for function fun0:
 # CHECK-LABEL: bb.0:
 # CHECK: liveins:{{.*}} $r6d

diff  --git a/llvm/test/Transforms/Inline/null-function.ll b/llvm/test/Transforms/Inline/null-function.ll
index 93f447fb1f5f..19b6715a93f5 100644
--- a/llvm/test/Transforms/Inline/null-function.ll
+++ b/llvm/test/Transforms/Inline/null-function.ll
@@ -5,5 +5,5 @@ entry:
   ret i32 0
 }
 
-; CHECK: *** IR Dump Before Inliner for always_inline functions ***
+; CHECK: *** IR Dump Before Inliner for always_inline functions (always-inline) ***
 ; CHECK: Printing <null> Function


        


More information about the cfe-commits mailing list