Hi,

I’ve updated the patch so that -fipa-reorder-for-locality now uses tp_first_run 
instead of a custom field.

This patch adds support for explicit function reordering for
-fipa-reorder-for-locality. This is done by setting tp_first_run for each
processed function in ipa locality cloning pass.  All functions are then sorted
using tp_first_run in expand_all_functions ().

Bootstrapped and regtested on aarch64-linux-gnu.
Ok for mainline?

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

gcc/ChangeLog:

        * cgraphunit.cc (tp_first_run_node_cmp): Update condition.
        (expand_all_functions): Ditto.
        * ipa-locality-cloning.cc (get_default_locality_order): New function.
        (add_node_to_partition): Update tp_first_run.


> On 13 Jan 2026, at 3:26 PM, Prachi Godbole <[email protected]> wrote:
>
> As discussed, the binutils/linker changes are present since this commit -
> https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=5fa5f8f5fe494ba4fe98c11899a5464cd164ec75
>
>> On 6 Jan 2026, at 2:46 PM, Prachi Godbole <[email protected]> wrote:
>>
>> Ping
>>
>>> On 18 Dec 2025, at 9:03 PM, Prachi Godbole <[email protected]> wrote:
>>>
>>> A gentle ping
>>>
>>>> On 9 Dec 2025, at 3:11 PM, Prachi Godbole <[email protected]> wrote:
>>>>
>>>> Ping
>>>>
>>>>> On 30 Oct 2025, at 10:48 AM, Prachi Godbole <[email protected]> wrote:
>>>>>
>>>>> Ping
>>>>>
>>>>>> On 9 Oct 2025, at 9:10 PM, Prachi Godbole <[email protected]> wrote:
>>>>>>
>>>>>> This patch adds support to linker driven function reordering by creating 
>>>>>> function sections with a prefix '.text.sorted' which are then sorted 
>>>>>> using SORT in by the linker. Appropriate support for this is already 
>>>>>> present in binutils.
>>>>>>
>>>>>> Bootstrapped and regtested on aarch64-linux-gnu. Ok for mainline?
>>>>>>
>>>>>> Thanks,
>>>>>> Prachi
>>>>>>
>>>>>> Signed-off-by: Prachi Godbole [email protected]
>>>>>>
>>>>>> gcc/ChangeLog:
>>>>>>
>>>>>> * cgraph.cc (cgraph_node::dump): Dump value of text_locality_order.
>>>>>> * cgraph.h (struct cgraph_node): New variable text_locality_order.
>>>>>> * cgraphclones.cc (cgraph_node::create_clone): Initialize
>>>>>> text_locality_order.
>>>>>> * cgraphunit.cc (expand_all_functions): Update text_locality_order.
>>>>>> * ipa-locality-cloning.cc (get_default_locality_order): New function.
>>>>>> (add_node_to_partition): Update text_locality_order.
>>>>>> * lto-cgraph.cc (lto_output_node): Write text_locality_order to file.
>>>>>> (input_node): Read text_locality_order.
>>>>>> * varasm.cc (default_function_section): Create function sections based
>>>>>> on text_locality_order.
>>>>>>
>>>>>> <0001-PATCH-Use-linker-sections-to-explicitly-order-functi.patch>
>>>>>
>>>>
>>>
>>
>

Attachment: 0001-PATCH-Use-tp_first_run-to-explicitly-order-functions.patch
Description: 0001-PATCH-Use-tp_first_run-to-explicitly-order-functions.patch

Reply via email to