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.
This commit is contained in:
Richard Biener 2020-11-03 15:03:41 +01:00
parent d0d8a16580
commit c5b49c3e09
3 changed files with 14 additions and 2 deletions

View File

@ -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

View File

@ -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.

View File

@ -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]);