This is an archive of the discontinued LLVM Phabricator instance.

[NewPM] Use parameterized syntax for a couple of more passes
ClosedPublic

Authored by bjope on Aug 19 2021, 3:46 AM.

Details

Summary

A couple of passes that are parameterized in new-PM used different
pass names (in cmd line interface) while using the same pass class
name. This patch updates the PassRegistry to model pass parameters
more properly using PASS_WITH_PARAMS.

Reason for the change is to ensure that we have a 1-1 mapping
between class name and pass name (when disregarding the params).
With a 1-1 mapping it is more obvious which pass name to use in
options such as -debug-only, -print-after etc.

The opt -passes syntax is changed for the following passes:

early-cse-memssa => early-cse<memssa>
post-inline-ee-instrument => ee-instrument<post-inline>
loop-extract-single => loop-extract<single>
lower-matrix-intrinsics-minimal => lower-matrix-intrinsics<minimal>

This patch is not updating pass names in docs/Passes.rst. Not quite
sure what the status is for that document (e.g. when it comes to
listing pass paramters). It is only loop-extract-single that is
mentioned in Passes.rst today, out of the passes mentioned above.

Diff Detail

Event Timeline

bjope created this revision.Aug 19 2021, 3:46 AM
bjope requested review of this revision.Aug 19 2021, 3:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 19 2021, 3:46 AM
aeubanks added inline comments.Aug 19 2021, 9:43 AM
llvm/tools/opt/NewPMDriver.cpp
432

we can probably delete RUN lines from tests that the legacy PM with these passes

bjope added inline comments.Aug 19 2021, 10:56 AM
llvm/tools/opt/NewPMDriver.cpp
432

I also think that this is kind of an ugly workaround (at least unless we can phase out the -enable-new-pm hack quite soon). But as long as we support -enable-new-pm=1 together with the legacy syntax for specifying passes to run I believe that the alternative would be to add these passes to the list of passes that force legacy PM. Because it is impossible to use the new names including '<>' without also using -passes='...'.

A bit sad that your RFC to start clean up lit tests from using -enable-new-pm didn't get more attention. But maybe that at least was a sign that there isn't that many objections to move forward with cleaning up uses of -enable-new-pm.

aeubanks accepted this revision.Aug 19 2021, 11:11 AM
aeubanks added inline comments.
llvm/tools/opt/NewPMDriver.cpp
432

that's fair. can you add a TODO to delete once we've cleaned up tests?

This revision is now accepted and ready to land.Aug 19 2021, 11:11 AM
asbirlea accepted this revision.Aug 19 2021, 11:54 AM

Thank you for this cleanup.

llvm/lib/Passes/PassRegistry.def
350

A cleanup follow up: for naming consistency, this can be updated to "memoryssa"?
The tests below will become -passes='require<memoryssa>,invalidate<aa>,early-cse<memoryssa>'
This will need updating the legacy PM naming and all tests, so I don't expect it to be included in this patch.