[PATCH] D149345: [Utils] Added the ability to print the pass number and IR after it is triggered

Dmitry Bakunevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 3 09:45:38 PDT 2023


dbakunevich added inline comments.


================
Comment at: llvm/lib/Passes/StandardInstrumentations.cpp:739
+    if (shouldPrintPassNumbers())
+      dbgs() << " Running pass " << CurrentPassNumber << " " << PassID << "\n";
+
----------------
aeubanks wrote:
> seems like this should be part of `PrintPassInstrumentation` instead
I don't agree with you. All the logic described for saving the pass number and subsequent printing of the IR is tied to the logic of registering callbacks in the PrintIRInstrumentation class.


================
Comment at: llvm/lib/Passes/StandardInstrumentations.cpp:742
+    if (shouldPrintAfterPassNumber() && CurrentPassNumber == PrintAfterPassNumber) {
+      dbgs() << "*** IR Dump After " << CurrentPassNumber << "-" << PassID
+             << " on " << IRName << " ***\n";
----------------
aeubanks wrote:
> this duplicates the logic below and always prints the entire module, can you keep it more consistent with the current code?
Okay, I'll change this moment.


================
Comment at: llvm/test/Other/print-after-pass-number.ll:1
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
+; RUN: opt -passes="loop(indvars,loop-deletion,loop-unroll-full)" -print-after-pass-number=3 -S -o /dev/null %s 2>&1 | FileCheck %s
----------------
aeubanks wrote:
> this shouldn't use update_test_checks.py, it should be checking the headers the instrumentation prints
Okay, I'll change this moment.


================
Comment at: llvm/test/Other/print-pass-number.ll:3
+;
+; REQUIRES: asserts
+
----------------
aeubanks wrote:
> I don't think this requires asserts
Okay, I'll change this moment.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149345/new/

https://reviews.llvm.org/D149345



More information about the llvm-commits mailing list