public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew MacLeod <amacleod@redhat.com>
To: gcc-patches <gcc-patches@gcc.gnu.org>
Cc: "hernandez, aldy" <aldyh@redhat.com>
Subject: [COMMITTED] Don't set useless relations.
Date: Mon, 17 Oct 2022 09:25:04 -0400	[thread overview]
Message-ID: <cddfdaaa-5384-a4bc-ace5-5319962c4443@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 329 bytes --]

The oracle will not register nonsense/useless relations, (basically X op 
X).  Symbolically,  x == x  is implied, and x != x, x< x, etc are all 
nonsense.

Now that we are using class value_relation in a couple of other places, 
it shouldn't either.

Bootstrapped on  x86_64-pc-linux-gnu with no regressions. Pushed.

Andrew

[-- Attachment #2: 0001-Don-t-set-useless-relations.patch --]
[-- Type: text/x-patch, Size: 1473 bytes --]

From fca529517484bf19098ca9efa77e95534086abdc Mon Sep 17 00:00:00 2001
From: Andrew MacLeod <amacleod@redhat.com>
Date: Fri, 14 Oct 2022 14:31:02 -0400
Subject: [PATCH 1/4] Don't set useless relations.

The oracle will not register nonssense/useless relations, class
value_relation shouldn't either.

	* value-relation.cc (value_relation::dump): Change message.
	* value-relation.h (value_relation::set_relation): If op1 is the
	same as op2 do not create a relation.
---
 gcc/value-relation.cc | 2 +-
 gcc/value-relation.h  | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/gcc/value-relation.cc b/gcc/value-relation.cc
index 50fc190a36b..3fb7b96c9e0 100644
--- a/gcc/value-relation.cc
+++ b/gcc/value-relation.cc
@@ -891,7 +891,7 @@ value_relation::dump (FILE *f) const
 {
   if (!name1 || !name2)
     {
-      fprintf (f, "uninitialized");
+      fprintf (f, "no relation registered");
       return;
     }
   fputc ('(', f);
diff --git a/gcc/value-relation.h b/gcc/value-relation.h
index a3bbe1e8157..fa9097a8069 100644
--- a/gcc/value-relation.h
+++ b/gcc/value-relation.h
@@ -349,6 +349,13 @@ value_relation::set_relation (relation_kind r, tree n1, tree n2)
 {
   gcc_checking_assert (TREE_CODE (n1) == SSA_NAME
 		       && TREE_CODE (n2) == SSA_NAME);
+  if (n1 == n2)
+    {
+      related = VREL_VARYING;
+      name1 = NULL_TREE;
+      name2 = NULL_TREE;
+      return;
+    }
   related = r;
   name1 = n1;
   name2 = n2;
-- 
2.37.3


                 reply	other threads:[~2022-10-17 13:25 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=cddfdaaa-5384-a4bc-ace5-5319962c4443@redhat.com \
    --to=amacleod@redhat.com \
    --cc=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).