From: Richard Biener Date: Tue, 3 Nov 2020 14:03:41 +0000 (+0100) Subject: tree-optimization/97623 - limit PRE hoist insertion X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c5b49c3e092c0de5cd684b0acd244129dfaae324;p=gcc.git 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 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. --- diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 89168be1d2f..5320e6c1e1e 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 7bac39a9d58..a33a371a395 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 091ecb39bb6..39c52c9b0f0 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]);