[llvm-dev] [RFC] Changing the default pass manager for the optimization pipeline

Arthur Eubanks via llvm-dev llvm-dev at lists.llvm.org
Thu Feb 4 11:36:15 PST 2021


On Thu, Feb 4, 2021 at 9:34 AM Björn Pettersson A <
bjorn.a.pettersson at ericsson.com> wrote:

> Hi!
>
>
>
> Are there any existing plans for making the help text for opt more easy to
> understand?
>
> Here are some things that have been bugging me so far:
>
>
>
> Currently it for example doesn’t mention that –O0, –O1, etc are designed
> for legacy-pm (with new-pm it is a bit of a mess since you get the wrong
> aa-pipeline when for example using –O3).
>
> So are those options supposed to be removed, or should they remain as a
> short-form for “-passes=default<O3> -aa-pipeline=default” etc?
>
I'd like to remove these at some point and just go with
-passes='default<O#>', but they'll likely remain until we decide to start
removing the legacy PM and we start cleaning up tests to only use -passes=.
I'll update the description for these flags.

>
>
> opt -help-hidden lists all the legacy passes (under “Optimizations
> available:”), but those now require -enable-new-pm=0. Maybe that is obvious.
>
> But I’m missing a similar list mentioning all things that are legal to put
> in the -passes string.
>
The legacy PM registered passes to a global variable which made this easier
to do in the legacy PM. The new PM doesn't have a global registry, but
rather each PassBuilder is initialized with the list of passes on its own.
I'll draft up something to try to get this working.

>
>
> And options like -debug-pass-manager and -debug-pass=Arguments only work
> depending on which PM that is used, but that is not mentioned in the help
> text so one need to figure it out by trial and error. Although most of the
> time you don’t get an error, you just don’t get the requested
> functionality. So it would be helpful if the help text mention in what
> situation those options can be used or not (or there should be errors if
> using them in the wrong context).
>
I'll update the help text. Each pass manager's debug logging is separate,
rather than being tied to a global variable like the legacy PM's
-debug-pass, so it's a bit weird to check in each new PM PassManager if
-debug-pass has been specified.

>
>
> Downstream we implement fuzzy testing by using “opt -O3
> -debug-pass=Arguments” in order to get a list of passes that are used
> randomly on the opt command line.
>
> I haven’t figured out yet how to implement something similar with the new
> pm. Is there a way to make opt output the pass names available (that can be
> used in -passes string)?
>
There was some discussion about similar things in the bugpoint + new PM
thread. The way the new PM is designed doesn't really lend itself to this
sort of functionality. It could be possible for each type of PassManager to
print out the names of all the passes it contains, but we'd need some
change with the way we handle pass names (e.g. remove PassInfoMixin and
have each pass declare its own name). Rather, I think something like the
PassInstrumentation approach that -opt-bisect-limit does is better, where
you can turn off a specific set of passes. But I could be convinced of a
different approach.

>
>
> Regards,
>
> Björn
>

Thanks for the questions, these are good for making things clearer to
users.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210204/48583222/attachment.html>


More information about the llvm-dev mailing list