lkml.org 
[lkml]   [2015]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH] x86: Turn off GCC branch probability heuristics
    From
    On Apr 11, 2015 2:20 AM, "Ingo Molnar" <mingo@kernel.org> wrote:
    >
    > Another thing caught my attention (and I'm hijacking the RCU thread
    > again): GCC's notion of how to place branches seems somewhat random,
    > and rather bloaty.
    >
    > So I tried the experiment below on an x86 defconfig, turning off GCC's
    > branch heuristics, and it's rather surprising:
    >
    > text data bss dec filename
    > 12566447 1617840 1089536 15273823 vmlinux.fguess-branch-probability
    > 11923593 1617840 1089536 14630969 vmlinux.fno-guess-branch-probability
    >
    > That's an 5.4% code size improvement!

    Ugh. That's much larger than I would have expected. Is it just because
    gcc ends up turning

    if (a)
    b
    c

    into

    if (a) goto out-of-line
    return:
    c
    ..
    out-of-line:
    c
    goto return;

    a lot? Still, 5% sounds insanely big.

    How much of that 5% comes from code alignment? Or was this on *top* of
    the 1-byte alignment testt?

    Linus


    \
     
     \ /
      Last update: 2015-04-11 20:21    [W:10.060 / U:0.036 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site