aboutsummaryrefslogtreecommitdiff
path: root/gcc/params.opt
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2022-08-08 12:20:04 +0200
committerRichard Biener <rguenther@suse.de>2022-08-09 10:14:30 +0200
commit409978d58dafa689c5b3f85013e2786526160f2c (patch)
treea4d418443807c4fe46fb021edaff2baee469b617 /gcc/params.opt
parent8a16b9f983824b6b9a25275cd23b6bba8c98b800 (diff)
downloadgcc-409978d58dafa689c5b3f85013e2786526160f2c.zip
gcc-409978d58dafa689c5b3f85013e2786526160f2c.tar.gz
gcc-409978d58dafa689c5b3f85013e2786526160f2c.tar.bz2
tree-optimization/106514 - add --param max-jump-thread-paths
The following adds a limit for the exponential greedy search of the backwards jump threader. The idea is to limit the search space in a way that the paths considered are the same if the search were in BFS order rather than DFS. In particular it stops considering incoming edges into a block if the product of the in-degrees of blocks on the path exceeds the specified limit. When considering the low stmt copying limit of 7 (or 1 in the size optimize case) this means the degenerate case with maximum search space is a sequence of conditions with no actual code B1 |\ | empty |/ B2 |\ ... Bn |\ GIMPLE_CONDs are costed 2, an equivalent GIMPLE_SWITCH already 4, so we reach 7 already with 3 middle conditions (B1 and Bn do not count). The search space would be 2^4 == 16 to reach this. The FSM threads historically allowed for a thread length of 10 but is really looking for a single multiway branch threaded across the backedge. I've chosen the default of the new parameter to 64 which effectively limits the outdegree of the switch statement (the cases reaching the backedge) to that number (divided by 2 until I add some special pruning for FSM threads due to the loop header indegree). The testcase ssa-dom-thread-7.c requires 56 at the moment (as said, some special FSM thread pruning of considered edges would bring it down to half of that), but we now get one more threading and quite some more in later threadfull. This testcase seems to be difficult to check for expected transforms. The new testcases add the degenerate case we currently thread (without deciding whether that's a good idea ...) plus one with an approripate limit that should prevent the threading. This obsoletes the mentioned --param max-fsm-thread-length but I am not removing it as part of this patch. When the search space is limited the thread stmt size limit effectively provides max-fsm-thread-length. The param with its default does not help PR106514 enough to unleash path searching with the higher FSM stmt count limit. PR tree-optimization/106514 * params.opt (max-jump-thread-paths): New. * doc/invoke.texi (max-jump-thread-paths): Document. * tree-ssa-threadbackward.cc (back_threader::find_paths_to_names): Honor max-jump-thread-paths, take overall_path argument. (back_threader::find_paths): Pass 1 as initial overall_path. * gcc.dg/tree-ssa/ssa-thread-16.c: New testcase. * gcc.dg/tree-ssa/ssa-thread-17.c: Likewise. * gcc.dg/tree-ssa/ssa-dom-thread-7.c: Adjust.
Diffstat (limited to 'gcc/params.opt')
-rw-r--r--gcc/params.opt4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/params.opt b/gcc/params.opt
index 2f9c9cf..1329873 100644
--- a/gcc/params.opt
+++ b/gcc/params.opt
@@ -582,6 +582,10 @@ Bound on the number of iterations the brute force # of iterations analysis algor
Common Joined UInteger Var(param_max_jump_thread_duplication_stmts) Init(15) Param Optimization
Maximum number of statements allowed in a block that needs to be duplicated when threading jumps.
+-param=max-jump-thread-paths=
+Common Joined UInteger Var(param_max_jump_thread_paths) Init(64) IntegerRange(1, 65536) Param Optimization
+Search space limit for the backwards jump threader.
+
-param=max-last-value-rtl=
Common Joined UInteger Var(param_max_last_value_rtl) Init(10000) Param Optimization
The maximum number of RTL nodes that can be recorded as combiner's last value.