I’ve updated the patch as per discussion and lowered the default value. 
Attaching the new version here.

This patch turns off -fipa-reorder-for-locality for -fprofile-generate because
it's not required and contributes to the bloated time taken by bootstrap.  It
also reduces the default partition size by half; the increased number of
partitions speeds up LTRANS phase.

Bootstrapped and tested on aarch64-none-linux-gnu. OK for mainline?

Signed-off-by: Prachi Godbole <[email protected]>

config/ChangeLog:

        * bootstrap-lto-locality.mk (STAGE2_CFLAGS): Add param
        lto-max-locality-partition.
        (STAGE3_CFLAGS): Ditto.
        (STAGEprofile_CFLAGS): Remove -fipa-reorder-for-locality.
        (STAGEtrain_CFLAGS): Ditto.

gcc/Changelog:

        * params.opt: Change default param value.



> On 16 Jan 2026, at 6:09 PM, Prachi Godbole <[email protected]> wrote:
> 
> 
> 
>> On 16 Jan 2026, at 5:56 PM, Jan Hubicka <[email protected]> wrote:
>> 
>> External email: Use caution opening links or attachments
>> 
>> 
>>> Thank you Honza for the review
>>> 
>>> 
>>> The default value was tuned according to the target applications - large 
>>> applications that benefit from the higher size. This results in majority of 
>>> the target applications not needing param adjustment. I see ~5-10% 
>>> improvement for the current default over a lower value.
>>> 
>>> The adjustment I made here was for additional build time improvement 
>>> specifically for GCC bootstrap with the intention that the target 
>>> applications can use the pass without needing it.
>> 
>> I see that 5-10% improvement is quite important for the specific
>> use-case.  It is kind of unfortunate that we need to tune the parameter
>> so high. Is it something that can be fixed by better code placement
>> across adjacent partitions (which can be acomplished by tp_first_run
>> machinery and also your new numbered textsubsections) or is it really
>> about late IPA optimizations (such as register alloation) being important
>> and ltrans partition being in a way?
>> 
>> I think we should go with reasonable defaults (which does not bow up
>> build times) in GCC, so perhaps param should be lowered by default to
>> what we need for bootstrap and have the target app to bump it up in its
>> config.
>> 
>> Hozna
> 
> Unfortunately, it’s about IPA optimizations and specifically how many clones 
> are created - having too low a default will blow up the code size. Following 
> your suggestion, I’ll try with a lowered default - meeting halfway between 
> current default and the param here so that we don’t blow up build time and 
> also the apps don’t require too much adjustment. I’ll be back with that patch
> 
> Thanks,
> Prachi
> 

Attachment: 0001-ipa-reorder-for-locality-Adjust-bootstrap-lto-locali.patch
Description: 0001-ipa-reorder-for-locality-Adjust-bootstrap-lto-locali.patch

Reply via email to