From a83df7d68c8fe3794a847303e981f7f0f48b358b Mon Sep 17 00:00:00 2001 From: tejohnson Date: Fri, 25 Sep 2015 16:53:40 +0000 Subject: [PATCH] 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 * opts.c (finish_options): Unset -freorder-blocks-and-partition if not using profile. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@228136 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/opts.c | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7c39c51..1142446 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-09-25 Teresa Johnson + + * opts.c (finish_options): Unset -freorder-blocks-and-partition + if not using profile. + 2015-09-25 Manuel López-Ibáñez PR pretty-print/67567 diff --git a/gcc/opts.c b/gcc/opts.c index b437114..2bbf653 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -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; -- 2.7.4