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

Nuri Amari via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 1 12:35:35 PDT 2023


nuriamari added a comment.
Herald added a subscriber: StephenFan.
Herald added a project: All.



In D54794#1306140 <https://reviews.llvm.org/D54794#1306140>, @chandlerc wrote:

> 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.

Hi @chandlerc I have a need for something like this, and have tried to implement something like you have suggested here: https://github.com/llvm/llvm-project/pull/65179. Would you mind giving me some feedback?


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54794/new/

https://reviews.llvm.org/D54794



More information about the llvm-commits mailing list