public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Function reorder with -fprofile-reorder-functions
@ 2022-01-26  0:48 prem paulson
  2022-02-01  5:59 ` prem paulson
  0 siblings, 1 reply; 2+ messages in thread
From: prem paulson @ 2022-01-26  0:48 UTC (permalink / raw)
  To: gcc-help

Hello,

I am experimenting with function reordering using PGO. I am looking at
ordering functions based on the Last time of execution. For example, if the
sequence of calls from profile feedback is:

func1() -> func2() -> func3() -> func1()->func4()

I would like the reordering in the binary as follows:

func2
func3
func1
func4

The closest option I see is -fprofile-reorder-functions but it reorders
based on the first time of execution.

-fprofile-reorder-functions
Function reordering based on profile instrumentation collects first time of
execution of a function and orders these functions in ascending order.

Is there any similar option that can help me achieve this?

Thanks in advance.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Function reorder with -fprofile-reorder-functions
  2022-01-26  0:48 Function reorder with -fprofile-reorder-functions prem paulson
@ 2022-02-01  5:59 ` prem paulson
  0 siblings, 0 replies; 2+ messages in thread
From: prem paulson @ 2022-02-01  5:59 UTC (permalink / raw)
  To: gcc-help

Bump.

Hello experts,

Looking through the code, I noticed cgraph_node::tp_first_run that helps in
implementation of "-fprofile-reorder-functions". Can someone please comment
on how feasible it would be to implement ordering functions based on "Last"
time of execution?

Thank you.


On Tue, Jan 25, 2022 at 4:48 PM prem paulson <prempaulson@gmail.com> wrote:

> Hello,
>
> I am experimenting with function reordering using PGO. I am looking at
> ordering functions based on the Last time of execution. For example, if the
> sequence of calls from profile feedback is:
>
> func1() -> func2() -> func3() -> func1()->func4()
>
> I would like the reordering in the binary as follows:
>
> func2
> func3
> func1
> func4
>
> The closest option I see is -fprofile-reorder-functions but it reorders
> based on the first time of execution.
>
> -fprofile-reorder-functions
> Function reordering based on profile instrumentation collects first time
> of execution of a function and orders these functions in ascending order.
>
> Is there any similar option that can help me achieve this?
>
> Thanks in advance.
>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-01  5:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-26  0:48 Function reorder with -fprofile-reorder-functions prem paulson
2022-02-01  5:59 ` prem paulson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).