On Tue, Apr 04, 2023 at 05:26:26PM +0200, Jakub Jelinek wrote: > On Tue, Apr 04, 2023 at 10:19:23AM -0500, Segher Boessenkool wrote: > > > > + /* Enable -free for zero extension and sign extension > > > > elimination.*/ > > > > + { OPT_LEVELS_2_PLUS, OPT_free, NULL, 1 }, > > > > > > I believe the options should be sorted by the OPT_LEVEL* they are given. > > > > If that is true, that rule is violated all over the place already. It > > doesn't make much sense anyway, the OPT_LEVEL* have no complete ordering > > at all. But, yeah, -O2 stuff after the -O1 stuff makes sense, and we do > > have such a partial ordering now. > > At least default_options_table sorts stuff like that. Sure, the larger > the table it is, the more it is important to be able to see clearly what > each level enables.
And ours is 16 lines including whitespace. But yeah, and the presentation can be improved other ways as well. The default_options_table has in order: /* -O1 and -Og optimizations. */ /* -O1 (and not -Og) optimizations. */ /* -O2 and -Os optimizations. */ /* -O2 and above optimizations, but not -Os or -Og. */ /* -O3 and -Os optimizations. */ /* -O3 optimizations. */ /* -O3 parameters. */ /* -Ofast adds optimizations to -O3. */ (and no OPT_LEVELS_ALL at all, the most common for us and probably most other targets. Logically these come first, if ordering by opt level). Either way, yes we should have some grouping. Not the same as the above, but something that does make some sense :-) Segher