[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 24 11:16:37 PDT 2023


aeubanks added inline comments.


================
Comment at: llvm/lib/Passes/StandardInstrumentations.cpp:772
+  if (shouldPrintPassNumbers())
+    dbgs() << " Running pass " << CurrentPassNumber << " " << PassID << "\n";
+
----------------
dbakunevich wrote:
> aeubanks wrote:
> > dbakunevich wrote:
> > > aeubanks wrote:
> > > > aeubanks wrote:
> > > > > extra space?
> > > > ditto for the one in printAfterPass, but actually shouldn't this go in printBeforePass?
> > > No, this logic should be near with PrintAtPassNumber.
> > I definitely think
> > ```
> >   ++CurrentPassNumber;
> > 
> >   if (shouldPrintPassNumbers())
> >     dbgs() << "Running pass " << CurrentPassNumber << " " << PassID << "\n";
> > ```
> > should be in printBeforePass, there's no reason to duplicate it between the two printAfterPasses (e.g. the extra space wasn't updated in the copy above)
> We can't do that because the before and after passes are different. Accordingly, if we transfer the printing of a pass with its ordinals to printBeforePass(), then the pass numbers will not correspond to those that can be displayed in printAfterPasses().
within a pass run, `++CurrentPassNumber` happens before any usage of it right now, that won't change by moving it to printBeforePass


================
Comment at: llvm/test/Other/print-at-pass-number.ll:8-9
+; AT-SAME: (i32 [[ARG:%.*]]) {
+; AT-NEXT:  bb:
+; AT-NEXT:    [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[ARG]], i32 0)
+; AT-NEXT:    [[TMP0:%.*]] = shl nuw i32 [[SMAX]], 1
----------------
aeubanks wrote:
> again, we shouldn't be checking the exact IR, that's prone to changes in the passes
> 
> and there should be a test for invalidated IR
ping on the invalidated IR test


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