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] Add FIXME note to backward threader.
Date: Thu, 14 Oct 2021 15:42:51 +0200	[thread overview]
Message-ID: <20211014134251.237651-1-aldyh@redhat.com> (raw)

There's a limitation in the path discovery bits in the backward
threader that I ran into recently and I'd like to document it so we
don't lose track of it.

Basically we stop looking if we find a threadable path through a PHI,
without taking into account that there could be multiple
paths through a PHI that resolve the path.  For example:

	x_5 = PHI <10(4), 20(5), ...>
	if (x_5 > 5)

I don't remember how we ended up skipping this, but it could existing
behavior from the old bits.  It probably skipped multiple threads
through a PHI since the generic copier couldn't re-using existing
threading paths anyhow.

Documenting for later fixing.
---
 gcc/tree-ssa-threadbackward.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gcc/tree-ssa-threadbackward.c b/gcc/tree-ssa-threadbackward.c
index 28c7ef8c872..496b68e0a82 100644
--- a/gcc/tree-ssa-threadbackward.c
+++ b/gcc/tree-ssa-threadbackward.c
@@ -282,6 +282,13 @@ back_threader::resolve_phi (gphi *phi, bitmap interesting)
 	  continue;
 	}
 
+      // FIXME: We currently stop looking if we find a threadable path
+      // through a PHI.  This is pessimistic, as there can be multiple
+      // paths that can resolve the path.  For example:
+      //
+      // x_5 = PHI <10(4), 20(5), ...>
+      // if (x_5 > 5)
+
       tree arg = gimple_phi_arg_def (phi, i);
       if (TREE_CODE (arg) == SSA_NAME)
 	{
-- 
2.31.1


                 reply	other threads:[~2021-10-14 13:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20211014134251.237651-1-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).