[llvm-dev] [RFC][NewPM] Migrating tests from `opt -foo` to `opt -passes=foo`

Arthur Eubanks via llvm-dev llvm-dev at lists.llvm.org
Mon Jun 28 18:33:48 PDT 2021

Now that the new PM has been the default for the optimization pipeline for
a while, I'd like to start thinking about next steps. Not quite deprecating
the legacy PM for the optimization pipeline yet, since we should wait for
the next LLVM release. But one thing we can start doing is cleaning up lit
tests that use opt.

There's been confusion over exactly how the -passes= parsing works, so I've
updated https://llvm.org/docs/NewPassManager.html (or rather just the
sources, seems like the webpage hasn't updated yet) with some details.

For background, `opt -foo` is currently already translated to `opt
-passes=foo` when the new PM is on (which is true by default).

I imagine this would be a short script that has a list of passes from
PassRegistry.def and the IR unit they operate on, and looks through RUN
lines with opt, deleting existing pass arguments and replacing them with a
-passes= argument. If we have more than one pass, each pass would be
wrapped in the proper adaptor.  For example, `opt -instcombine -globaldce`
becomes `opt -passes='function(instcombine),globaldce'`.

We need to make sure that we don't end up causing too many duplicate RUN
lines if we have tests that specify both `opt -foo` and `opt -passes=foo`.

We should wait until the next LLVM release before changing all opt tests
since we do want any bots using the legacy PM to still run opt tests
against the legacy PM. But until then we can pick a couple lesser-used
passes/test directories to touch up.

Note that this does not include any opt tests that test passes on available
under the legacy PM, which would be IR passes in the codegen pipeline.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210628/62e46a61/attachment.html>

More information about the llvm-dev mailing list