[flang-commits] [flang] Add flags to dump IR to a file before and after LLVM passes (PR #65179)

Nuri Amari via flang-commits flang-commits at lists.llvm.org
Thu Sep 7 09:52:35 PDT 2023


NuriAmari wrote:

> What about an option that just redirects the PrintIRInstrumentation output to files instead of stderr? The files can be something like `$N-$modulename.ll` where `$N` is an int that increments.

Yeah that's more or less what I'm working on now. My plan is:

- Add a flag that provides a directory to write files to
- If that flag is passed, write files of the structure `$N-$modulename-$passname-(before|after).ll` into that directory instead of writing to stderr
- If you pass both `-print-after=foo` and `-print-before=foo` the dump files for a particular run of Foo on a particular unit of IR should match except for the before / after suffix.

This should be relatively easy to implement in the old pass manager as well.

https://github.com/llvm/llvm-project/pull/65179


More information about the flang-commits mailing list