aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2022-08-16 14:14:55 +0200
committerRichard Biener <rguenther@suse.de>2022-08-16 14:18:39 +0200
commit9594e04e4e2abeb4ffd3ca134447ee9fe84f95a4 (patch)
tree29d4ffc63ccbeab0a56a08f858533181ab0a4be3
parent2b403297b111c990c331b5bbb6165b061ad2259b (diff)
downloadgcc-9594e04e4e2abeb4ffd3ca134447ee9fe84f95a4.zip
gcc-9594e04e4e2abeb4ffd3ca134447ee9fe84f95a4.tar.gz
gcc-9594e04e4e2abeb4ffd3ca134447ee9fe84f95a4.tar.bz2
Stop backwards thread discovery when leaving a loop
The backward threader copier cannot deal with the situation of copying blocks belonging to different loops and will reject those paths late. The following uses this to prune path discovery, saving on compile-time. Note the off-loop block is still considered as entry edge origin. * tree-ssa-threadbackward.cc (back_threader::find_paths_to_names): Do not walk further if we are leaving the current loop.
-rw-r--r--gcc/tree-ssa-threadbackward.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/tree-ssa-threadbackward.cc b/gcc/tree-ssa-threadbackward.cc
index b886027..1c36283 100644
--- a/gcc/tree-ssa-threadbackward.cc
+++ b/gcc/tree-ssa-threadbackward.cc
@@ -355,6 +355,12 @@ back_threader::find_paths_to_names (basic_block bb, bitmap interesting,
|| maybe_register_path ()))
;
+ // The backwards thread copier cannot copy blocks that do not belong
+ // to the same loop, so when the new source of the path entry no
+ // longer belongs to it we don't need to search further.
+ else if (m_path[0]->loop_father != bb->loop_father)
+ ;
+
// Continue looking for ways to extend the path but limit the
// search space along a branch
else if ((overall_paths = overall_paths * EDGE_COUNT (bb->preds))