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

Nicolas Guillemot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 25 13:54:45 PST 2021


nlguillemot created this revision.
nlguillemot added reviewers: jroelofs, thegameg, dsanders.
Herald added subscribers: dexonsmith, hiraditya.
nlguillemot requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97499

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


Index: llvm/test/Transforms/Inline/null-function.ll
===================================================================
--- llvm/test/Transforms/Inline/null-function.ll
+++ llvm/test/Transforms/Inline/null-function.ll
@@ -5,5 +5,5 @@
   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
Index: llvm/test/CodeGen/SystemZ/frame-26.mir
===================================================================
--- llvm/test/CodeGen/SystemZ/frame-26.mir
+++ 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
Index: llvm/lib/IR/LegacyPassManager.cpp
===================================================================
--- llvm/lib/IR/LegacyPassManager.cpp
+++ llvm/lib/IR/LegacyPassManager.cpp
@@ -745,8 +745,10 @@
   }
 
   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 @@
   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());
   }
 }
Index: clang/test/Misc/pr32207.c
===================================================================
--- clang/test/Misc/pr32207.c
+++ 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() {}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97499.326489.patch
Type: text/x-patch
Size: 2860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210225/dfa24f4a/attachment-0001.bin>


More information about the cfe-commits mailing list