[llvm] Add option to dump IR to files instead of stderr (PR #66412)

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 28 15:17:32 PDT 2023


aeubanks wrote:

> @aeubanks If I could ask quickly, what do you think the easiest way to test the same functionality but implemeted for the legacy pass manager would be?
> 
> Seems running `opt` with the legacy pass manager is no longer possible. Should I use `llc`, and if so is there a set of "no-op" like machine passes? Seems the original -print-after behavior was tested before the NPM came into the picture.

You can't run specific passes with `llc` since some passes depend on others having already run, so you can't really nicely test it with no-op passes. See how https://reviews.llvm.org/D133055 tested functionality for inspiration. You'll probably have to run all the codegen passes and test that something happened for a random pass that ran.

Also the `-print-before/after` for the legacy PM is too complicated, it [adds a whole pass to print](https://github.com/llvm/llvm-project/blob/3e9c36303ca72929275fb97767af43b3aa04cab1/llvm/lib/IR/LegacyPassManager.cpp#L742) rather than checking if it should print right before/after running the pass (like what https://reviews.llvm.org/D133055 does). We should probably rewrite it to be simpler first.

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


More information about the llvm-commits mailing list