This patch unsets -freorder-blocks-and-partition when -fprofile-use is not specified.
authorTeresa Johnson <tejohnson@google.com>
Fri, 25 Sep 2015 16:53:40 +0000 (16:53 +0000)
committerTeresa Johnson <tejohnson@gcc.gnu.org>
Fri, 25 Sep 2015 16:53:40 +0000 (16:53 +0000)
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.

2015-09-25  Teresa Johnson  <tejohnson@google.com>

* opts.c (finish_options): Unset -freorder-blocks-and-partition
if not using profile.

From-SVN: r228136

gcc/ChangeLog
gcc/opts.c

index 7c39c519ec25c7e15d6da93c1484adbad12af012..11424466667f87238c6a4b4b05ead1f5a4954ab1 100644 (file)
@@ -1,3 +1,8 @@
+2015-09-25  Teresa Johnson  <tejohnson@google.com>
+
+       * opts.c (finish_options): Unset -freorder-blocks-and-partition
+       if not using profile.
+
 2015-09-25  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
        PR pretty-print/67567
index b437114d40127f3641b5603b9a02e2afd28cb306..2bbf6534077984ed2266f25cf9a206e8861ccfc9 100644 (file)
@@ -821,6 +821,16 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
       opts->x_flag_reorder_blocks = 1;
     }
 
+  /* Disable -freorder-blocks-and-partition when -fprofile-use is not in
+     effect. 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.  */
+  if (opts->x_flag_reorder_blocks_and_partition
+      && !opts_set->x_flag_profile_use)
+    opts->x_flag_reorder_blocks_and_partition = 0;
+
   if (opts->x_flag_reorder_blocks_and_partition
       && !opts_set->x_flag_reorder_functions)
     opts->x_flag_reorder_functions = 1;