aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-pre.c
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/tree-ssa-pre.c
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/tree-ssa-pre.c')
-rw-r--r--gcc/tree-ssa-pre.c7
1 files changed, 5 insertions, 2 deletions
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]);