public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Compilation-time suggestion
@ 2004-01-19 17:46 Roger Sayle
  2004-01-19 17:58 ` Gabriel Dos Reis
  0 siblings, 1 reply; 2+ messages in thread
From: Roger Sayle @ 2004-01-19 17:46 UTC (permalink / raw)
  To: gcc


I have a proposal/suggestion for perhaps improving GCC compilation
time: Perhaps we could make more use of __builtin_expect inside the
compiler itself.

I'm not sure how much it would save us, but Jan's experiments
with profiled bootstraps seemed to be encouraging, if memory
serves.  Certainly, SPEC results are much more competative with
profiling enabled.

If our profiling tools could be used to identify a small number
of critial conditionals in the source code level, they could be
annotated with __builtin_expect.  Hopefully, this might be able
to gain us much of the benefit of profile-feedback statically,
assuming that its a few hotspots are responsible for a significant
fraction of the gain.

The usual use of macros in system.h can be used to allow the source
code to bootstrap on non-GCC compilers.

In addition to the tools locating critical conditionals at the
source code level, we'd also need the ability to identify those
__builtin_expect annotations that were incorrect or no longer
critical, to prevent too much obfuscation of the source code.
But certainly, machine generated functions such as the garbage
collector's traversals and insn-recog could be made expectation
aware.


Clearly, there are issues with training sets, and branch probabilities
that differ between one platform and another, but the hypothesis is
that a handfull, perhaps 100, __builtin_expect annotations might give
us a few percentage points, but maybe more.


Are the benefits of user-annotated branch predictions significant
enough to make them worth going after?  Do any of the distributions
come with a profile-optimized GCC?


Just throwing out a brain-storm to see if anyone has a better handle
on the potential benefits vs. increased maintenance overheads.

Roger
--

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

end of thread, other threads:[~2004-01-19 17:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-19 17:46 Compilation-time suggestion Roger Sayle
2004-01-19 17:58 ` Gabriel Dos Reis

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).