public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Roger Sayle <roger@eyesopen.com>
To: gcc@gcc.gnu.org
Subject: Compilation-time suggestion
Date: Mon, 19 Jan 2004 17:46:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.44.0401190934380.23549-100000@www.eyesopen.com> (raw)


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

             reply	other threads:[~2004-01-19 17:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-19 17:46 Roger Sayle [this message]
2004-01-19 17:58 ` Gabriel Dos Reis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.44.0401190934380.23549-100000@www.eyesopen.com \
    --to=roger@eyesopen.com \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).