[PATCH] D100231: [NewPM] Cleanup IR printing instrumentation

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 9 14:22:14 PDT 2021


aeubanks created this revision.
Herald added subscribers: kerbowa, hiraditya, nhaehnle, jvesely, arsenm.
aeubanks requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

-filter-print-funcs -print-changed was crashing after the filter func
was removed by a pass with

  Assertion failed: After.find("*** IR Dump") == 0 && "Unexpected banner format."

We weren't printing the banner because when we have -filter-print-funcs,
we print each function separately, letting the print function filter out
unwanted functions.

Being lazy with printing the banner seems hard to reason with, we should print it
unconditionally first (it could also lead to duplicate banners if we
have multiple functions in -filter-print-funcs).

While doing this, it seemed like the printIR() functions were doing too
many things. I separated out the call from PrintPassInstrumentation
since we were essentially doing two completely separate things in
printIR() from different callers.

To preserve D74814 <https://reviews.llvm.org/D74814>, we have to check if we're going to print anything at
all first. This is unfortunate, but I would consider this a special
case that shouldn't be handled in the core logic.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100231

Files:
  llvm/include/llvm/Analysis/LoopInfo.h
  llvm/include/llvm/Analysis/LoopInfoImpl.h
  llvm/lib/Analysis/LoopInfo.cpp
  llvm/lib/Passes/StandardInstrumentations.cpp
  llvm/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp
  llvm/test/Other/module-pass-printer.ll
  llvm/test/Other/print-changed-deleted.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100231.336564.patch
Type: text/x-patch
Size: 13542 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210409/31f3dd2d/attachment.bin>


More information about the llvm-commits mailing list