[Bug tree-optimization/66573] Unexpected change in static, branch-prediction cost from O1 to O2 in if-then-else.

segher at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Nov 21 09:16:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66573

Segher Boessenkool <segher at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |segher at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #6 from Segher Boessenkool <segher at gcc dot gnu.org> ---
bb-reorder changes the conditional branch so that the fallthrough path 
is the most likely.  It now also does this for -O1.  This is faster on
essentially all processors, including the ones the OP mentions.

Without profiling information showing otherwise, GCC assumes the call
to bar2 is more frequent than the one to bar1 (61% vs. 39%).  This is
a heuristic, it might need retuning, but that needs a lot more data
than this one testcase.

Closing as invalid.


More information about the Gcc-bugs mailing list