This is the mail archive of the gcc@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]

Re: basic-block and profile-based optimizing (was Re: New attribute"infrequent"?)


On Fri, 31 Aug 2001, Andreas Jaeger wrote:

> David Edelsohn <dje@watson.ibm.com> writes:
>
> >>>>>> Andreas Jaeger writes:
>
> I forgot the following (Honza stated it in one of his first emails) -
> and this is IMO the key issue:
>
> If GCC notices that a function is infrequently used, e.g. only used for
> error handling, and normally not used, a call to this function can be
> placed out of line, a branch to a block that contains such a call can
> be predicted as not taken.  But how does an application get the
> information that a function of the library is infrequently used?

This doesn't really matter, because the application itself presumabely
will be going through profile-based optimization.. Thus, when profiling
the application, we'll notice that the function call is seldom taken, and
thus we'll code it out-of-line at that time.

I don't think that adding such an attribute-mechanism to a library
interface is all that necessary, nor will it be worth the work and
maintance.

In addition, this may be a pessimization.. If an infrequently called
library function is invoked from an application function, we only want to
code it out-of-line if the application function has a lot of invocations,
which we won't know till profile-based feedback. Otherwise, doing it out
of line could just gives size and complexity.

Scott


--
No DVD movie will ever enter the public domain, nor will any CD. The last CD
and the last DVD will have moldered away decades before they leave copyright.
This is not encouraging the creation of knowledge in the public domain.


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