[PATCH] Disable -fno-reorder-blocks-and-partition if no -fprofile-use to avoid unnecessary overhead

Bernd Schmidt bschmidt@redhat.com
Fri Sep 25 14:14:00 GMT 2015


On 09/24/2015 07:16 PM, Teresa Johnson wrote:
> This patch unsets -freorder-blocks-and-partition when -fprofile-use
> is not specified. Function splitting was not actually being performed
> in that case, as probably_never_executed_bb_p does not distinguish
> any basic blocks as being cold vs hot when there is no profile data.
>
> Leaving it enabled, however, causes the assembly code generator to create
> (empty) cold sections and labels, leading to unnecessary size overhead.
>
> Bootstrapped and tested on x86-64-unknown-linux-gnu. Ok for trunk?
>
> Thanks,
> Teresa
>
> 2015-09-24  Teresa Johnson  <tejohnson@google.com>
>
>          * opts.c (finish_options): Unset -freorder-blocks-and-partition
>          if not using profile.

Hmm, I'd noticed I was getting that enabled by default. It looks like 
you added this default with:

2013-11-19  Teresa Johnson  <tejohnson@google.com>

        * common/config/i386/i386-common.c: Enable
        -freorder-blocks-and-partition at -O2 and up for x86.
        * doc/invoke.texi: Update -freorder-blocks-and-partition default.
        * opts.c (finish_options): Only warn if -freorder-blocks-and-
        partition was set on command line.

(Note that this ChangeLog entry should have mentioned 
ix86_option_optimization_table as the variable that was changed).

What has changed between then and now? Also, do we not use 
estimates/heuristics when not using a profile?


Bernd



More information about the Gcc-patches mailing list