aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/doc/invoke.texi3
-rw-r--r--gcc/params.opt4
-rw-r--r--gcc/tree-ssa-threadbackward.c9
3 files changed, 16 insertions, 0 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 0cc8a8e..c93d8224 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -14468,6 +14468,9 @@ Emit instrumentation calls to __tsan_func_entry() and __tsan_func_exit().
Maximum number of instructions to copy when duplicating blocks on a
finite state automaton jump thread path.
+@item max-fsm-thread-length
+Maximum number of basic blocks on a jump thread path.
+
@item parloops-chunk-size
Chunk size of omp schedule for loops parallelized by parloops.
diff --git a/gcc/params.opt b/gcc/params.opt
index 06a6fdc..83b3db6 100644
--- a/gcc/params.opt
+++ b/gcc/params.opt
@@ -533,6 +533,10 @@ The maximum number of nested indirect inlining performed by early inliner.
Common Joined UInteger Var(param_max_fields_for_field_sensitive) Param
Maximum number of fields in a structure before pointer analysis treats the structure as a single variable.
+-param=max-fsm-thread-length=
+Common Joined UInteger Var(param_max_fsm_thread_length) Init(10) IntegerRange(1, 999999) Param Optimization
+Maximum number of basic blocks on a jump thread path.
+
-param=max-fsm-thread-path-insns=
Common Joined UInteger Var(param_max_fsm_thread_path_insns) Init(100) IntegerRange(1, 999999) Param Optimization
Maximum number of instructions to copy when duplicating blocks on a finite state automaton jump thread path.
diff --git a/gcc/tree-ssa-threadbackward.c b/gcc/tree-ssa-threadbackward.c
index 8770be8..e378adb 100644
--- a/gcc/tree-ssa-threadbackward.c
+++ b/gcc/tree-ssa-threadbackward.c
@@ -620,6 +620,15 @@ back_threader_profitability::profitable_path_p (const vec<basic_block> &m_path,
if (m_path.length () <= 1)
return false;
+ if (m_path.length () > (unsigned) param_max_fsm_thread_length)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, " FAIL: Jump-thread path not considered: "
+ "the number of basic blocks on the path "
+ "exceeds PARAM_MAX_FSM_THREAD_LENGTH.\n");
+ return false;
+ }
+
int n_insns = 0;
gimple_stmt_iterator gsi;
loop_p loop = m_path[0]->loop_father;