[PATCH] D86360: Add new hidden option -print-changed which only reports changes to IR

Jamie Schmeiser via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 21 11:10:31 PDT 2020


jamieschmeiser created this revision.
jamieschmeiser added reviewers: aeubanks, yrouban, ychen.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
jamieschmeiser requested review of this revision.

A new hidden option -print-changed is added along with code to support
printing the IR as it passes through the opt pipeline in the new pass
manager.  Only those passes that change the IR are reported, with others
only having the banner reported, indicating that they did not change the
IR, were filtered out or ignored.  Filtering of output via the
-filter-print-funcs is supported and a new supporting hidden option
-filter-passes is added.  The latter takes a comma separated list of pass
names and filters the output to only show those passes in the list that
change the IR.  The output of both of these functions can be modified
via the -print-module-scope function.

The code introduces a template base class that generalizes the comparison
of IRs  that takes an IR representation as template parameter.  The
constructor takes a series of lambdas that provide an event based API
for generalized printing of IRs as they are changed in the opt pipeline
through the new pass manager.

The first of several instantiations is provided that prints the IR
in a form similar to that produced by -print-after-all with the above
mentioned filtering capabilities.  This version, and the others to
follow will be introduced at the upcoming developer's conference.
See https://hotcrp.llvm.org/usllvm2020/paper/29 for more information.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86360

Files:
  llvm/lib/IR/LegacyPassManager.cpp
  llvm/lib/Passes/StandardInstrumentations.cpp
  llvm/test/Other/change-printer.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86360.287067.patch
Type: text/x-patch
Size: 28136 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200821/a96ea3b5/attachment.bin>


More information about the llvm-commits mailing list