> On 24 Apr 2025, at 11:34, Jakub Jelinek <ja...@redhat.com> wrote: > > 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).
It was not intended to be exposed to users, it was used as a mechanism to check if flto-partition is explicitly set. > 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). Yes, I think I was confused about the use of opts_set. This is overly convoluted. So something like this? Checked manually that the required error is given, the default selected partitioning is balanced, and an explicit -flto-partition=max selects it properly. Running a full bootstrap cycle now. Thanks, Kyrill
0001-opts.cc-Simplify-handling-of-explicit-flto-partition.patch
Description: 0001-opts.cc-Simplify-handling-of-explicit-flto-partition.patch