aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-threadbackward.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2016-03-01 16:12:10 -0700
committerJeff Law <law@gcc.gnu.org>2016-03-01 16:12:10 -0700
commiteab2541b860c48203115ac6dca3284e982015d2c (patch)
tree48b5cf44ccfa93c5f48324a74c4d329401120df3 /gcc/tree-ssa-threadbackward.c
parent0bca04b822bc5ee0f5bbb2ba5df6669a433d0bf5 (diff)
downloadgcc-eab2541b860c48203115ac6dca3284e982015d2c.zip
gcc-eab2541b860c48203115ac6dca3284e982015d2c.tar.gz
gcc-eab2541b860c48203115ac6dca3284e982015d2c.tar.bz2
re PR tree-optimization/69196 (code size regression with jump threading at -O2)
PR tree-optimization/69196 * tree-ssa-threadbackward.c (fsm_find_control_statement_thread_paths): Appropriately clamp the number of statements to copy when the thread path does not traverse a loop backedge. PR tree-optimization/69196 * gcc.dg/tree-ssa/pr69196.c: New test. From-SVN: r233870
Diffstat (limited to 'gcc/tree-ssa-threadbackward.c')
-rw-r--r--gcc/tree-ssa-threadbackward.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/tree-ssa-threadbackward.c b/gcc/tree-ssa-threadbackward.c
index 3028504..747296b 100644
--- a/gcc/tree-ssa-threadbackward.c
+++ b/gcc/tree-ssa-threadbackward.c
@@ -429,6 +429,26 @@ fsm_find_control_statement_thread_paths (tree name,
continue;
}
+
+ /* If this path does not thread through the loop latch, then we are
+ using the FSM threader to find old style jump threads. This
+ is good, except the FSM threader does not re-use an existing
+ threading path to reduce code duplication.
+
+ So for that case, drastically reduce the number of statements
+ we are allowed to copy. */
+ if (!threaded_through_latch
+ && (n_insns * PARAM_VALUE (PARAM_FSM_SCALE_PATH_STMTS)
+ >= PARAM_VALUE (PARAM_MAX_JUMP_THREAD_DUPLICATION_STMTS)))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ "FSM did not thread around loop and would copy too "
+ "many statements.\n");
+ path->pop ();
+ continue;
+ }
+
/* When there is a multi-way branch on the path, then threading can
explode the CFG due to duplicating the edges for that multi-way
branch. So like above, only allow a multi-way branch on the path