[PATCH] D54794: [NewPM] -print-before/-print-after support for new pass manager

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 22 00:58:02 PST 2018


chandlerc added a comment.

I somewhat agree w/ Philip that this seems like too much complexity / machinery for what it does...

I'm personally not sure why we need to support what seems like a challenging interface to begin with to me...

I would personally be much more interested in making a single IR printing strategy that allows easy *post* processing along these lines. Here is a sketch of a design of something that would be more useful to me than these flags or the print-after-all flags, is sufficient to implement this logic with shell globs and `cat`, and likely not much more complex than this patch. Maybe even simpler:

Have a printer that accepts an optional directory parameter from the commandline. If unspecified, it creates a temporary director.

Within this directory, for each "nesting" pass run that is instrumented, it creates a directory named based on that pass name and a `.N` suffix where N is incremented from zero on each repeat of that pass at that level of nesting. While "inner" passes are running, set the target directory to the created one, and once finished, pop it back to the incoming target directory. For all passes, including "nesting" ones, write out a file `<module-name>.<pass-name>.<run number at nest level>.{before,after}.ll` that is a dump of the module.

Here, a "nesting" pass is just one that begins running, and another pass begins running before it ends running.

This seems easy to implement with some basic stack logic in the printer, etc.

If we want to get really fancy, give an option to write out a `.tar` or `.zip` file with this rather than an actual directory tree, and users can then implement these before/after things with a command to extract files matching a wildcard pattern.

What do you think?


Repository:
  rL LLVM

https://reviews.llvm.org/D54794





More information about the llvm-commits mailing list