On Thu, Apr 24, 2025 at 11:27:36AM +0200, Jakub Jelinek wrote:
> > This is a thinko in the logic for handling the default -flto-partition=
> > arguments. We should override it to balanced only if it stayed as default
> > up to that point. We should also be testing opts instead of opts_set here.
> > 
> > Bootstrapped and tested on aarch64-none-linux-gnu.
> > 
> > Ok for trunk? Sorry for the late patch, but I guess we want this in the GCC 
> > 15 branch as well.
> > Thanks,
> > Kyrill
> > 
> > Signed-off-by: Kyrylo Tkachov <ktkac...@nvidia.com>
> > 
> > gcc/
> > 
> >     * opts.cc (finish_options): Check for == against LTO_PARTITION_DEFAULT
> >     before setting LTO_PARTITION_BALANCED.
> 
> I think
>      opts_set->x_flag_lto_partition = opts->x_flag_lto_partition = 
> LTO_PARTITION_BALANCED;                                                       
>                                      
> is also wrong.
> opts_set should have bool in whatever type the field has, so I think it
> should be
>     {
>       opts->x_flag_lto_partition = LTO_PARTITION_BALANCED;
>       opts_set->x_flag_lto_partition = true;
>     }
> (or maybe just opts->x_flag_lto_partition = LTO_PARTITION_BALANCED; alone?).
> LTO_PARTITION_BALANCED is 2...

In fact, I wonder why LTO_PARTITION_DEFAULT and -flto-partition=default has
been added at all (and it isn't documented).
I'd have expected instead of the LTO_PARTITION_DEFAULT checks one should be
testing !opts_set->x_flag_lto_partition (i.e. -flto-partition=balanced
should be the default, but when not specified explicitly, it would really
match that
       error ("%<-fipa-reorder-for-locality%> is incompatible with"             
                                                                                
                     
              " an explicit %qs option", "-flto-partition");                    
                                                                                
                     
error wording (right now -fipa-reorder-for-locality -flto-partition=default
is explicit, yet no error is emittetd).

        Jakub

Reply via email to