aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-unswitch.cc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2022-12-01 16:14:14 +0100
committerRichard Biener <rguenther@suse.de>2022-12-02 08:04:11 +0100
commit5b50850c3c6f2eceb8012dcc8d3cd5ddd94fac6c (patch)
treea4fda0ea5379aad9eb7fea8143025b8175df1cee /gcc/tree-ssa-loop-unswitch.cc
parenta710f3ce7474792c098ac6fe4dc6a366cdbb4fb4 (diff)
downloadgcc-5b50850c3c6f2eceb8012dcc8d3cd5ddd94fac6c.zip
gcc-5b50850c3c6f2eceb8012dcc8d3cd5ddd94fac6c.tar.gz
gcc-5b50850c3c6f2eceb8012dcc8d3cd5ddd94fac6c.tar.bz2
Add --param max-unswitch-depth
The following adds a --param to limit the depth of unswitched loop nests. One can use --param max-unswitch-depth=1 to disable unswitching of outer loops (the innermost loop will then be unswitched). PR tree-optimization/107946 * params.opt (-param=max-unswitch-depth=): New. * doc/invoke.texi (--param=max-unswitch-depth): Document. * tree-ssa-loop-unswitch.cc (init_loop_unswitch_info): Honor --param=max-unswitch-depth
Diffstat (limited to 'gcc/tree-ssa-loop-unswitch.cc')
-rw-r--r--gcc/tree-ssa-loop-unswitch.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/tree-ssa-loop-unswitch.cc b/gcc/tree-ssa-loop-unswitch.cc
index e8c9bd6..df7a201 100644
--- a/gcc/tree-ssa-loop-unswitch.cc
+++ b/gcc/tree-ssa-loop-unswitch.cc
@@ -263,8 +263,10 @@ init_loop_unswitch_info (class loop *&loop, unswitch_predicate *&hottest,
/* Unswitch only nests with no sibling loops. */
class loop *outer_loop = loop;
+ unsigned max_depth = param_max_unswitch_depth;
while (loop_outer (outer_loop)->num != 0
- && !loop_outer (outer_loop)->inner->next)
+ && !loop_outer (outer_loop)->inner->next
+ && --max_depth != 0)
outer_loop = loop_outer (outer_loop);
hottest = NULL;
hottest_bb = NULL;