aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-11-03 15:03:41 +0100
committerRichard Biener <rguenther@suse.de>2020-11-03 16:23:06 +0100
commitc5b49c3e092c0de5cd684b0acd244129dfaae324 (patch)
tree26c53d09691a9fff15eff1e8e04159df25b925b1 /gcc
parentd0d8a1658054258baae87b445678c1c0c08d9455 (diff)
downloadgcc-c5b49c3e092c0de5cd684b0acd244129dfaae324.zip
gcc-c5b49c3e092c0de5cd684b0acd244129dfaae324.tar.gz
gcc-c5b49c3e092c0de5cd684b0acd244129dfaae324.tar.bz2
tree-optimization/97623 - limit PRE hoist insertion
This limits insert iteration caused by PRE insertions generating hoist insertion opportunities and vice versa. The patch limits the hoist insertion iterations to three by default. 2020-11-03 Richard Biener <rguenther@suse.de> PR tree-optimization/97623 * params.opt (-param=max-pre-hoist-insert-iterations): New. * doc/invoke.texi (max-pre-hoist-insert-iterations): Document. * tree-ssa-pre.c (insert): Do at most max-pre-hoist-insert-iterations hoist insert iterations.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/doc/invoke.texi5
-rw-r--r--gcc/params.opt4
-rw-r--r--gcc/tree-ssa-pre.c7
3 files changed, 14 insertions, 2 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 89168be..5320e6c 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -13408,6 +13408,11 @@ is aborted and the load or store is not considered redundant. The
number of queries is algorithmically limited to the number of
stores on all paths from the load to the function entry.
+@item max-pre-hoist-insert-iterations
+The maximum number of iterations doing insertion during code
+hoisting which is done as part of the partial redundancy elimination
+insertion phase.
+
@item ira-max-loops-num
IRA uses regional register allocation by default. If a function
contains more loops than the number given by this parameter, only at most
diff --git a/gcc/params.opt b/gcc/params.opt
index 7bac39a..a33a371 100644
--- a/gcc/params.opt
+++ b/gcc/params.opt
@@ -597,6 +597,10 @@ Maximum depth of sqrt chains to use when synthesizing exponentiation by a real c
Common Joined UInteger Var(param_max_predicted_iterations) Init(100) IntegerRange(0, 65536) Param Optimization
The maximum number of loop iterations we predict statically.
+-param=max-pre-hoist-insert-iterations=
+Common Joined UInteger Var(param_max_pre_hoist_insert_iterations) Init(3) Param Optimization
+The maximum number of insert iterations done for PRE code hoisting.
+
-param=max-reload-search-insns=
Common Joined UInteger Var(param_max_reload_search_insns) Init(100) Param Optimization
The maximum number of instructions to search backward when looking for equivalent reload.
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 091ecb3..39c52c9 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -3647,8 +3647,11 @@ insert (void)
changed = false;
/* Insert expressions for hoisting. Do a backward walk here since
- inserting into BLOCK exposes new opportunities in its predecessors. */
- if (flag_code_hoisting)
+ inserting into BLOCK exposes new opportunities in its predecessors.
+ Since PRE and hoist insertions can cause back-to-back iteration
+ limit that on the hoist side. */
+ if (flag_code_hoisting
+ && num_iterations <= param_max_pre_hoist_insert_iterations)
for (int idx = rpo_num - 1; idx >= 0; --idx)
{
basic_block block = BASIC_BLOCK_FOR_FN (cfun, rpo[idx]);