summaryrefslogtreecommitdiff
path: root/gcc/bb-reorder.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/bb-reorder.c')
-rw-r--r--gcc/bb-reorder.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index 3bf2dc72c7e..b636c1e3a1d 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -2225,7 +2225,15 @@ rest_of_handle_reorder_blocks (void)
splitting possibly introduced more crossjumping opportunities. */
cfg_layout_initialize (CLEANUP_EXPENSIVE);
- if (flag_reorder_blocks || flag_reorder_blocks_and_partition)
+ if ((flag_reorder_blocks || flag_reorder_blocks_and_partition)
+ /* Don't reorder blocks when optimizing for size because extra jump insns may
+ be created; also barrier may create extra padding.
+
+ More correctly we should have a block reordering mode that tried to
+ minimize the combined size of all the jumps. This would more or less
+ automatically remove extra jumps, but would also try to use more short
+ jumps instead of long jumps. */
+ && optimize_function_for_speed_p (cfun))
{
reorder_basic_blocks ();
cleanup_cfg (CLEANUP_EXPENSIVE);