This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -fno-guess-branch-probability switch...
- From: mike stump <mrs at windriver dot com>
- To: dfladebo at starband dot net, gcc at gnu dot org
- Date: Mon, 6 May 2002 11:19:35 -0700 (PDT)
- Subject: Re: -fno-guess-branch-probability switch...
- References: <200205052157.45718.dfladebo@starband.net>
> From: Dave Fladebo <dfladebo@starband.net>
> To: gcc@gnu.org
> Date: Sun, 5 May 2002 21:57:45 -0500
> Great work to all - I just ran some benchmark stuff with gcc v3.0.4 against
> VC++ v7.0 on the same (dual boot Linux / WinXP) box, and gcc generally comes
> out on top. Amazing!!!
> What exactly does the following imply?
> ---------------
> -fno-guess-branch-probability
> Sometimes gcc will opt to guess branch probabilities when none are
> available from either profile directed feedback (`-fprofile-arcs')
> or `__builtin_expect'. In a hard real-time system, people don't
> want different runs of the compiler to produce code that has different
> behavior; minimizing non-determinism is of paramount import. This
> switch allows users to reduce non-determinism, possibly at the expense
> of inferior optimization.
> ---------------
> It almost sounds to me like the branch-prediction is being done "randomly" in
> some cases, so that the exact same code may be compiled differently given the
> exact same compiler options, etc...
> That is NOT correct, right??? In other words, the following statement would be
> true:
> "Given the same source code and compiler switches, the gcc/g++ compiler will
> produce the exact same binary code."
I suspect it is just a realization that the profiling files are
_source_ code to the compiler, and changes to that source code,
results in changes to the generated binary code. When one uses
-frepo, the .rpo files are also part of the `source' code.
When one wants the same binary, they have to be able to control the
source code, and managing the profile files is a new science and
presents new challenges.
When one doesn't think of it this way, well, the results of the
compiler may indeed appear to be `random' to the untrained eye.
I don't like the wording on the passage you quote at all.