__builtin_expect vs. PGO

Ian Lance Taylor iant@google.com
Wed Dec 21 16:56:00 GMT 2011


Scott Meyers <NeverRead@aristeia.com> writes:

> What has more weight during codegen in a compilation with
> -fprofile-use when the code uses __builtin_expect to favor one branch
> while the PGO data says the other branch is more likely?

I believe the probabilities will be combined in that case.  The
weighting of __builtin_expect is such that it will most likely be the
predicted case, unless the profiling data says that the unexpected path
is always taken.

Ian



More information about the Gcc-help mailing list