This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: disabling branch probability guessing (patch)
- To: Aldy Hernandez <aldyh at redhat dot com>
- Subject: Re: disabling branch probability guessing (patch)
- From: Jeffrey A Law <law at redhat dot com>
- Date: Mon, 15 Jan 2001 22:33:50 -0700
- cc: gcc-patches at gcc dot gnu dot org, wilson at redhat dot com
- Reply-To: law at redhat dot com
In message <20010115181006.A8129@redhat.com>you write:
> hi guys.
>
> Here is a patch that adds an option to disable guessing of branch
> probabilities (-fno-guess-branch-probability).
>
> One of our clients is trying to use __builtin_expect and is getting
> unexpected results because estimate_probability() in predict.c is
> guessing the branch probability in an undetermined way. This patch
> solves the problem by providing an option to disable the probability
> guessing altogether.
Err. umm. It seems to me like __builtin_expect ought to just override the
guessed probability for any particular branch. Is there something about
the implementation of branch prediction and __builtin_expect that makes
this hard?
jeff