This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Profile driven specialization of indirect/virtual calls


> On 12/28/06, Tomas Bily <tbily@suse.cz> wrote:
> >Hi,
> >
> > this patch does not handle inter-module calls. It works with
> >-fwhole-program -combine gcc flags but this flags are currently
> >supported only for C frontend now.
> 
> It should still be able to use a direct call for the most called
> function, right?

Hi,
the code resolve destination of direct call only within compilation unit
(it assigns each function UID and measure most common UID rather than
most common branch target address since the second would require tying
into GCC some linker support to demangle the results back to original
functions).

The drawback of this is obviously that it won't produce direct call to
other compilation unit, but it should not be that bad, since current
CPUs all predict computed call destination anyway.

With some runtime support, the analysis can be done global: you assign
UIDs globally at program startup time and save them into profile
together with the map to functions they originate from.  This can be
done incrementally if it seems profitable.

Honza
> 
> Richard.
> 
> > Tomas
> >
> >> Hi Tomas,
> >>
> >> How does this patch handle indirect calls across files ?
> >> e.g. the caller and the callee are in different source files.
> >>
> >> This particular optimization will be most effective and useful
> >> when combined with LTO, and for various reasons,
> >> it would be nice if the profile collection (-fprofile-generate)
> >> doesn't have to use LTO as well.
> >>
> >> Seongbae


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]