public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Disable -fno-reorder-blocks-and-partition if no -fprofile-use to avoid unnecessary overhead
@ 2015-09-24 18:49 Teresa Johnson
  2015-09-24 19:02 ` pinskia
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Teresa Johnson @ 2015-09-24 18:49 UTC (permalink / raw)
  To: gcc-patches, Jan Hubicka; +Cc: Xinliang David Li

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.

Index: opts.c
===================================================================
--- opts.c      (revision 228062)
+++ opts.c      (working copy)
@@ -821,7 +821,17 @@ finish_options (struct gcc_options *opts, struct g
       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;


-- 
Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-09-26 22:02 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-24 18:49 [PATCH] Disable -fno-reorder-blocks-and-partition if no -fprofile-use to avoid unnecessary overhead Teresa Johnson
2015-09-24 19:02 ` pinskia
2015-09-25 14:14 ` Bernd Schmidt
2015-09-25 14:26   ` Teresa Johnson
2015-09-25 14:34     ` Bernd Schmidt
2015-09-25 14:54     ` Jan Hubicka
2015-09-25 16:58       ` Teresa Johnson
2015-09-25 16:58 ` Andi Kleen
2015-09-25 17:23   ` Teresa Johnson
2015-09-25 17:36     ` Jeff Law
2015-09-25 19:13       ` Andi Kleen
2015-09-27  0:55         ` Bernhard Reutner-Fischer
2015-09-27 10:24           ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).