public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Stop backwards thread discovery when leaving a loop
@ 2022-08-16 12:18 Richard Biener
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2022-08-16 12:18 UTC (permalink / raw)
  To: gcc-patches

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.

Bootstrapped and tested on x86_64-unknown-linux-gnu.

I've split this out from the 'Support threading of just the exit edge'
patch under discussion - it's really an independent change.

Pushed.

	* tree-ssa-threadbackward.cc (back_threader::find_paths_to_names):
	Do not walk further if we are leaving the current loop.
---
 gcc/tree-ssa-threadbackward.cc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/tree-ssa-threadbackward.cc b/gcc/tree-ssa-threadbackward.cc
index b886027fccf..1c362839fab 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))
-- 
2.35.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] Stop backwards thread discovery when leaving a loop
@ 2022-08-16 12:18 Richard Biener
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2022-08-16 12:18 UTC (permalink / raw)
  To: gcc-patches

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.

Bootstrapped and tested on x86_64-unknown-linux-gnu.

I've split this out from the 'Support threading of just the exit edge'
patch under discussion - it's really an independent change.

Pushed.

	* tree-ssa-threadbackward.cc (back_threader::find_paths_to_names):
	Do not walk further if we are leaving the current loop.
---
 gcc/tree-ssa-threadbackward.cc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/tree-ssa-threadbackward.cc b/gcc/tree-ssa-threadbackward.cc
index b886027fccf..1c362839fab 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))
-- 
2.35.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] Stop backwards thread discovery when leaving a loop
@ 2022-08-16 12:18 Richard Biener
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2022-08-16 12:18 UTC (permalink / raw)
  To: gcc-patches

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.

Bootstrapped and tested on x86_64-unknown-linux-gnu.

I've split this out from the 'Support threading of just the exit edge'
patch under discussion - it's really an independent change.

Pushed.

	* tree-ssa-threadbackward.cc (back_threader::find_paths_to_names):
	Do not walk further if we are leaving the current loop.
---
 gcc/tree-ssa-threadbackward.cc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/tree-ssa-threadbackward.cc b/gcc/tree-ssa-threadbackward.cc
index b886027fccf..1c362839fab 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))
-- 
2.35.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-16 12:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-16 12:18 [PATCH] Stop backwards thread discovery when leaving a loop Richard Biener
2022-08-16 12:18 Richard Biener
2022-08-16 12:18 Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).