[llvm] [StandardInstrumentations] Support -print-after-pass-number option (PR #87458)

Vincent Lee via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 5 18:31:31 PDT 2024


================
@@ -802,6 +807,8 @@ void PrintIRInstrumentation::printBeforePass(StringRef PassID, Any IR) {
       (shouldPrintBeforePass(PassID) || shouldPrintAfterPass(PassID)))
     DumpIRFilename = fetchDumpFilename(PassID, IR);
 
+  ++CurrentPassNumber;
----------------
thevinster wrote:

print-at-pass-number.ll does test the pass numbers are consecutive (although it doesn't test passes where the IR isn't printed). If we want to preserve the existing behavior, I can hoist the `shouldPrintIR` call above. The reason for hoisting incrementing `CurrentPassNumber` is so to have the `shouldPrintAfterPass` run after which is needed in the `printAfterPass` call. 

https://github.com/llvm/llvm-project/pull/87458


More information about the llvm-commits mailing list