[llvm] cb5612c - Add IR name to -print-pass-numbers output

Artur Pilipenko via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 20 20:20:14 PDT 2023


Author: Artur Pilipenko
Date: 2023-10-20T20:19:23-07:00
New Revision: cb5612c99b0b8773cc8c5e1b6418b341285c5b14

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

LOG: Add IR name to -print-pass-numbers output

Print the name of the module/function/loop the pass
ran on.

Added: 
    

Modified: 
    llvm/lib/Passes/StandardInstrumentations.cpp
    llvm/test/Other/print-at-pass-number.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Passes/StandardInstrumentations.cpp b/llvm/lib/Passes/StandardInstrumentations.cpp
index 95920305f983033..06cc58c0219632d 100644
--- a/llvm/lib/Passes/StandardInstrumentations.cpp
+++ b/llvm/lib/Passes/StandardInstrumentations.cpp
@@ -812,7 +812,8 @@ void PrintIRInstrumentation::printBeforePass(StringRef PassID, Any IR) {
   ++CurrentPassNumber;
 
   if (shouldPrintPassNumbers())
-    dbgs() << " Running pass " << CurrentPassNumber << " " << PassID << "\n";   
+    dbgs() << " Running pass " << CurrentPassNumber << " " << PassID
+           << " on " << getIRName(IR) << "\n";
 
   if (!shouldPrintBeforePass(PassID))
     return;

diff  --git a/llvm/test/Other/print-at-pass-number.ll b/llvm/test/Other/print-at-pass-number.ll
index 3f7cb7c8e5881c7..8b2d3144e09259c 100644
--- a/llvm/test/Other/print-at-pass-number.ll
+++ b/llvm/test/Other/print-at-pass-number.ll
@@ -24,8 +24,8 @@ bb4:                                              ; preds = %bb1
   ret i32 %add3
 }
 
-; NUMBER: Running pass 1 LoopSimplifyPass
-; NUMBER-NEXT: Running pass 2 LCSSAPass
-; NUMBER-NEXT: Running pass 3 IndVarSimplifyPass
-; NUMBER-NEXT: Running pass 4 LoopDeletionPass
+; NUMBER:  Running pass 1 LoopSimplifyPass on bar
+; NUMBER-NEXT: Running pass 2 LCSSAPass on bar
+; NUMBER-NEXT: Running pass 3 IndVarSimplifyPass on bb1
+; NUMBER-NEXT: Running pass 4 LoopDeletionPass on bb1
 ; NUMBER-NOT: Running pass


        


More information about the llvm-commits mailing list