public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@redhat.com>
To: GCC patches <gcc-patches@gcc.gnu.org>
Subject: [COMMITTED] Avoid repeating calculations in threader.
Date: Thu,  4 Nov 2021 15:39:47 +0100	[thread overview]
Message-ID: <20211104143948.1102399-2-aldyh@redhat.com> (raw)
In-Reply-To: <20211104143948.1102399-1-aldyh@redhat.com>

We already attempt to resolve the current path on entry to
find_paths_to_name(), so there's no need to do so again for each
exported range since nothing has changed.

Removing this redundant calculation avoids 22% of calls into the path
solver.

Tested on x86-64 and ppc64le Linux with the usual regstrap.  I also
verified that the before and after number of threads was the same
in a suite of .ii files from a bootstrap.

gcc/ChangeLog:

	PR tree-optimization/102943
	* tree-ssa-threadbackward.c (back_threader::find_paths_to_names):
	Avoid duplicate calculation of paths.
---
 gcc/tree-ssa-threadbackward.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/gcc/tree-ssa-threadbackward.c b/gcc/tree-ssa-threadbackward.c
index 29e9d6a3f90..b7eaff94567 100644
--- a/gcc/tree-ssa-threadbackward.c
+++ b/gcc/tree-ssa-threadbackward.c
@@ -443,18 +443,6 @@ back_threader::find_paths_to_names (basic_block bb, bitmap interesting)
 	      goto leave_bb;
 	    }
 	}
-      // Examine blocks that define or export an interesting SSA,
-      // since they may compute a range which resolve this path.
-      if ((def_bb == bb
-	   || bitmap_bit_p (m_ranger->gori ().exports (bb), i))
-	  && m_path.length () > 1)
-	{
-	  if (maybe_register_path ())
-	    {
-	      done = true;
-	      goto leave_bb;
-	    }
-	}
     }
 
   // If there are interesting names not yet processed, keep looking.
-- 
2.31.1


  reply	other threads:[~2021-11-04 14:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-04 14:39 [COMMITTED] path solver: Only compute relations for imports Aldy Hernandez
2021-11-04 14:39 ` Aldy Hernandez [this message]
2021-11-04 14:39 ` [COMMITTED] path solver: Prefer range_of_expr instead of range_on_edge Aldy Hernandez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211104143948.1102399-2-aldyh@redhat.com \
    --to=aldyh@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).