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

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 17 09:38:59 PDT 2023


aeubanks added a comment.

mostly looks good

I do think this number of conditions in `PrintIRInstrumentation` is getting to be a bit much, but for now this is fine

if we're sometimes not actually printing IR in `PrintIRInstrumentation` with `print-pass-numbers` and only printing `Running pass...`, I think we should consider merging it with `PrintPassInstrumentation`, but that doesn't need to be done here



================
Comment at: llvm/lib/Passes/StandardInstrumentations.cpp:114
+static cl::opt<unsigned>
+    PrintAfterPassNumber("print-after-pass-number", cl::init(0), cl::Hidden,
+                cl::desc("Print IR after pass with this number as "
----------------
aeubanks wrote:
> this seems more like `print-at-pass-number` rather than `print-after-pass-number` IIUC
other function/var names/comments should be updated as well


================
Comment at: llvm/lib/Passes/StandardInstrumentations.cpp:772
+  if (shouldPrintPassNumbers())
+    dbgs() << " Running pass " << CurrentPassNumber << " " << PassID << "\n";
+
----------------
extra space?


================
Comment at: llvm/test/Other/print-after-pass-number.ll:5
+define i32 @bar(i32 %arg) {
+; AFTER-LABEL: define i32 @bar
+; AFTER-SAME: (i32 [[ARG:%.*]]) {
----------------
we shouldn't check the exact IR here, something like

```
; AFTER: IR Dump after FooPass-3 on bar
; AFTER-NEXT: define i32 @bar
```
is better. and also a similar test for one where the IR is invalidated


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