aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2015-12-17 16:33:44 -0700
committerJeff Law <law@gcc.gnu.org>2015-12-17 16:33:44 -0700
commit72ca20f9cb4755c8f1eacedcf229a5d6827039d3 (patch)
tree56a61439f85b853a276516f7416b8845a06d3886
parentaa3987819a5ab392bcb125efe84008e75f99bbfc (diff)
downloadgcc-72ca20f9cb4755c8f1eacedcf229a5d6827039d3.zip
gcc-72ca20f9cb4755c8f1eacedcf229a5d6827039d3.tar.gz
gcc-72ca20f9cb4755c8f1eacedcf229a5d6827039d3.tar.bz2
[PATCH] Limit path splitting to loops we optimize for speed
* doc/invoke.texi (-O2 options): Remove -fsplit-paths. (-O3 options): Add -fsplit-paths. * gimple-ssa-split-paths.c: Include predict.h (split_paths): Only split paths in a loop that should be optimized for speed. * opts.c (default_options_table): Move -fsplit-paths from -O2 to -O3. * gcc.dg/tree-ssa/split-path-1.c: Explicitly ask for path splitting optimizations. From-SVN: r231790
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/doc/invoke.texi3
-rw-r--r--gcc/gimple-ssa-split-paths.c8
-rw-r--r--gcc/opts.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/split-path-1.c2
6 files changed, 25 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a1f71bd..070b2dd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2015-12-17 Jeff Law <law@redhat.com>
+
+ * doc/invoke.texi (-O2 options): Remove -fsplit-paths.
+ (-O3 options): Add -fsplit-paths.
+ * gimple-ssa-split-paths.c: Include predict.h
+ (split_paths): Only split paths in a loop that should be
+ optimized for speed.
+ * opts.c (default_options_table): Move -fsplit-paths from -O2 to
+ -O3.
+
2015-12-17 Nathan Sidwell <nathan@acm.org>
* ipa-icf.c (sem_item_optimizer::merge): Don't pick 'main' as the
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index cdc5d2c..60530c0 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -7836,7 +7836,6 @@ also turns on the following optimization flags:
-frerun-cse-after-loop @gol
-fsched-interblock -fsched-spec @gol
-fschedule-insns -fschedule-insns2 @gol
--fsplit-paths @gol
-fstrict-aliasing -fstrict-overflow @gol
-ftree-builtin-call-dce @gol
-ftree-switch-conversion -ftree-tail-merge @gol
@@ -7853,7 +7852,7 @@ Optimize yet more. @option{-O3} turns on all optimizations specified
by @option{-O2} and also turns on the @option{-finline-functions},
@option{-funswitch-loops}, @option{-fpredictive-commoning},
@option{-fgcse-after-reload}, @option{-ftree-loop-vectorize},
-@option{-ftree-loop-distribute-patterns},
+@option{-ftree-loop-distribute-patterns}, @option{-fsplit-paths}
@option{-ftree-slp-vectorize}, @option{-fvect-cost-model},
@option{-ftree-partial-pre} and @option{-fipa-cp-clone} options.
diff --git a/gcc/gimple-ssa-split-paths.c b/gcc/gimple-ssa-split-paths.c
index 602e916..540fdf3 100644
--- a/gcc/gimple-ssa-split-paths.c
+++ b/gcc/gimple-ssa-split-paths.c
@@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. If not see
#include "cfgloop.h"
#include "gimple-iterator.h"
#include "tracer.h"
+#include "predict.h"
/* Given LATCH, the latch block in a loop, see if the shape of the
path reaching LATCH is suitable for being split by duplication.
@@ -180,9 +181,14 @@ split_paths ()
FOR_EACH_LOOP (loop, LI_FROM_INNERMOST)
{
+ /* Only split paths if we are optimizing this loop for speed. */
+ if (!optimize_loop_for_speed_p (loop))
+ continue;
+
/* See if there is a block that we can duplicate to split the
path to the loop latch. */
- basic_block bb = find_block_to_duplicate_for_splitting_paths (loop->latch);
+ basic_block bb
+ = find_block_to_duplicate_for_splitting_paths (loop->latch);
/* BB is the merge point for an IF-THEN-ELSE we want to transform.
diff --git a/gcc/opts.c b/gcc/opts.c
index d46f304..7ab585f 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -523,11 +523,11 @@ static const struct default_options default_options_table[] =
{ OPT_LEVELS_2_PLUS, OPT_fisolate_erroneous_paths_dereference, NULL, 1 },
{ OPT_LEVELS_2_PLUS, OPT_fipa_ra, NULL, 1 },
{ OPT_LEVELS_2_PLUS, OPT_flra_remat, NULL, 1 },
- { OPT_LEVELS_2_PLUS, OPT_fsplit_paths, NULL, 1 },
/* -O3 optimizations. */
{ OPT_LEVELS_3_PLUS, OPT_ftree_loop_distribute_patterns, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_fpredictive_commoning, NULL, 1 },
+ { OPT_LEVELS_3_PLUS, OPT_fsplit_paths, NULL, 1 },
/* Inlining of functions reducing size is a good idea with -Os
regardless of them being declared inline. */
{ OPT_LEVELS_3_PLUS_AND_SIZE, OPT_finline_functions, NULL, 1 },
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d5ae299..baa159d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-12-17 Jeff Law <law@redhat.com>
+
+ * gcc.dg/tree-ssa/split-path-1.c: Explicitly ask for path
+ splitting optimizations.
+
2015-12-17 Nathan Sidwell <nathan@acm.org>
* gcc.dg/ipa/ipa-icf-merge-1.c: New.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/split-path-1.c b/gcc/testsuite/gcc.dg/tree-ssa/split-path-1.c
index 5c96241..b24f6a9 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/split-path-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/split-path-1.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-O2 -fdump-tree-split-paths-details " } */
+/* { dg-options "-O2 -fsplit-paths -fdump-tree-split-paths-details " } */
#include <stdio.h>
#include <stdlib.h>