[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 02:23:28 PST 2018


chandlerc added a comment.

In an IRC discussion, some interesting points were raised about this, and I wanted to try to give a better naming pattern and more concrete outline. I'll do it by giving a pseudo output tree I could imagine:

  $PREFIX/mymodule.0.M2FA.before.ll
  $PREFIX/mymodule.0.M2FA/0.foo.FPM.before.ll
  $PREFIX/mymodule.0.M2FA/0.foo.FPM/0.InstCombine.before.ll
  $PREFIX/mymodule.0.M2FA/0.foo.FPM/0.InstCombine.after.ll
  $PREFIX/mymodule.0.M2FA/0.foo.FPM/1.SimplifyCFG.before.ll
  $PREFIX/mymodule.0.M2FA/0.foo.FPM/1.SimplifyCFG.after.ll
  $PREFIX/mymodule.0.M2FA/0.foo.FPM.after.ll
  $PREFIX/mymodule.0.M2FA/1.bar.FPM.before.ll
  $PREFIX/mymodule.0.M2FA/1.bar.FPM/0.InstCombine.before.ll
  $PREFIX/mymodule.0.M2FA/1.bar.FPM/0.InstCombine.after.ll
  $PREFIX/mymodule.0.M2FA/1.bar.FPM/1.SimplifyCFG.before.ll
  $PREFIX/mymodule.0.M2FA/1.bar.FPM/1.SimplifyCFG.after.ll
  $PREFIX/mymodule.0.M2FA/1.bar.FPM.after.ll
  $PREFIX/mymodule.0.M2FA.after.ll

Here I'm using `$PREFIX` to mean "however we get a a directory". I guess either a flag value or `createUniqueDirectory` stuff.

I'm also using `M2FA` as a short name for the module-to-function pass adapter, and `FPM` for a function pass manager.

For the each .ll file, we'll also want to offer one specific level of filtering that can only really be implemented in the compiler: how much of the module goes into the file?

My suggestion would be that there are three reasonable options here:

1. the entire module at that point in time
2. the smallest enclosing IR unit to the IR unit being processed which we can do the equivalent of `llvm-extract` to produce a stand-alone module around. We could start with just extracting a function passes for function pass and smaller. But a follow-up would be to extract the set of functions in the SCC for SCC passes, etc. The key thing here is that we would do the extract and produce a valid module in all cases, just minimizing the IR in it.
3. just the dump of the IR unit in question, despite it not necessarily being a complete module

While I think #3 is the right default for the print-after-all style flag, I think the default for the tree dump should be #2.


Repository:
  rL LLVM

https://reviews.llvm.org/D54794





More information about the llvm-commits mailing list