From: "Martin Liška" <mliska@suse.cz>
To: Richard Biener <richard.guenther@gmail.com>,
Jan Hubicka <hubicka@ucw.cz>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH 3/9] operand_equal_p: add support for OBJ_TYPE_REF.
Date: Fri, 13 Sep 2019 12:30:00 -0000 [thread overview]
Message-ID: <73160761-cd59-9dc1-9a8d-b274c00eb2ba@suse.cz> (raw)
In-Reply-To: <CAFiYyc3+Af5n3nGacQLWA8Q94gCmrpHKUbc4JxPE3U3f6Anbbw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 319 bytes --]
On 8/20/19 8:39 AM, Richard Biener wrote:
> Anyhow, the original patch is OK if you compare
> OBJ_TYPE_REF_TOKEN/OBJECT irrespective of virtual_method_call_p
> and order the types_same_for_odr last since that's most expensive.
Hi.
It's done in the attached patch that survives bootstrap and regression
tests.
Martin
[-- Attachment #2: 0003-operand_equal_p-add-support-for-OBJ_TYPE_REF.patch --]
[-- Type: text/x-patch, Size: 1991 bytes --]
From 645e2df84ccd1f9a4b41f0a73a5398ff81696cdc Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Thu, 15 Aug 2019 10:34:41 +0200
Subject: [PATCH 3/9] operand_equal_p: add support for OBJ_TYPE_REF.
gcc/ChangeLog:
2019-07-24 Martin Liska <mliska@suse.cz>
* fold-const.c (operand_equal_p): Support OBJ_TYPE_REF.
* tree.c (add_expr): Hash parts of OBJ_TYPE_REF.
---
gcc/fold-const.c | 18 ++++++++++++++++++
gcc/tree.c | 6 ++++++
2 files changed, 24 insertions(+)
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index f57fffb9655..12f5a06a524 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -3325,6 +3325,24 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags)
flags &= ~OEP_ADDRESS_OF;
return OP_SAME (1) && OP_SAME (2);
+ /* Virtual table call. */
+ case OBJ_TYPE_REF:
+ {
+ if (!operand_equal_p (OBJ_TYPE_REF_EXPR (arg0),
+ OBJ_TYPE_REF_EXPR (arg1), flags))
+ return false;
+ if (tree_to_uhwi (OBJ_TYPE_REF_TOKEN (arg0))
+ != tree_to_uhwi (OBJ_TYPE_REF_TOKEN (arg1)))
+ return false;
+ if (!operand_equal_p (OBJ_TYPE_REF_OBJECT (arg0),
+ OBJ_TYPE_REF_OBJECT (arg1), flags))
+ return false;
+ if (!types_same_for_odr (obj_type_ref_class (arg0),
+ obj_type_ref_class (arg1)))
+ return false;
+ return true;
+ }
+
default:
return false;
}
diff --git a/gcc/tree.c b/gcc/tree.c
index b5e5876bbb3..20eb1682435 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -8028,6 +8028,12 @@ add_expr (const_tree t, inchash::hash &hstate, unsigned int flags)
inchash::add_expr (TARGET_EXPR_SLOT (t), hstate, flags);
return;
+ /* Virtual table call. */
+ case OBJ_TYPE_REF:
+ inchash::add_expr (OBJ_TYPE_REF_EXPR (t), hstate, flags);
+ inchash::add_expr (OBJ_TYPE_REF_TOKEN (t), hstate, flags);
+ inchash::add_expr (OBJ_TYPE_REF_OBJECT (t), hstate, flags);
+ return;
default:
break;
}
--
2.23.0
next prev parent reply other threads:[~2019-09-13 12:30 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-22 12:50 [RFC] operand_equal_p with valueization Jan Hubicka
2015-05-22 13:40 ` Richard Biener
2015-05-22 14:12 ` Jan Hubicka
2015-05-26 8:18 ` Richard Biener
2015-05-26 19:09 ` Jan Hubicka
2015-05-27 8:49 ` Richard Biener
2019-06-18 11:10 ` [RFC] " Martin Liška
2019-08-06 15:44 ` [PATCH 0/9] IPA ICF overhaul Martin Liska
2019-08-06 15:43 ` [PATCH 1/9] Replace int with boolean in predicate functions Martin Liska
2019-08-07 12:38 ` Richard Biener
2019-08-06 15:43 ` [PATCH 8/9] Remove comparison for polymorphic types Martin Liska
2019-08-06 15:43 ` [PATCH 4/9] Strengthen alias_ptr_types_compatible_p in LTO mode Martin Liska
2019-08-07 12:05 ` Richard Biener
2019-08-08 12:09 ` Martin Liška
2019-08-09 11:20 ` Richard Biener
2019-08-06 15:43 ` [PATCH 2/9] operand_equal_p: add support for FIELD_DECL Martin Liska
2019-08-07 12:21 ` Richard Biener
2019-08-15 14:19 ` Jan Hubicka
2019-08-16 9:28 ` Richard Biener
2019-08-16 12:17 ` Jan Hubicka
2019-09-11 12:58 ` Martin Liška
2019-08-06 15:43 ` [PATCH 7/9] IPA ICF: remove dead code Martin Liska
2019-08-08 14:44 ` Jeff Law
2019-08-06 15:43 ` [PATCH 9/9] Remove alias set comparison Martin Liska
2019-08-07 15:58 ` Martin Sebor
2019-08-08 8:43 ` Martin Liška
2019-08-08 15:21 ` Martin Sebor
2019-08-08 14:44 ` Jeff Law
2019-08-06 15:43 ` [PATCH 5/9] Come up with an abstraction Martin Liska
2019-08-08 16:29 ` Michael Matz
2019-08-12 11:49 ` Martin Liška
2019-08-12 12:27 ` Richard Biener
2019-08-12 12:43 ` Martin Liška
2019-08-12 13:26 ` Richard Biener
2019-08-12 14:48 ` Martin Liška
2019-08-14 13:17 ` Richard Biener
2019-08-14 13:50 ` Martin Liška
2019-08-14 14:38 ` Richard Biener
2019-08-16 11:06 ` Martin Liška
2019-09-18 7:56 ` Martin Liška
2019-09-19 11:30 ` Richard Biener
2019-08-12 13:40 ` Michael Matz
2019-08-09 11:48 ` Richard Biener
2019-08-06 15:43 ` [PATCH 6/9] Integrate that for IPA ICF Martin Liska
2019-08-16 11:10 ` Martin Liška
2019-08-06 15:55 ` [PATCH 3/9] operand_equal_p: add support for OBJ_TYPE_REF Martin Liska
2019-08-07 12:09 ` Richard Biener
2019-08-15 15:44 ` Jan Hubicka
2019-08-16 9:25 ` Richard Biener
2019-08-16 12:11 ` Jan Hubicka
2019-08-19 14:03 ` Richard Biener
2019-08-19 15:12 ` Jan Hubicka
2019-08-20 14:29 ` Richard Biener
2019-08-20 14:42 ` Jan Hubicka
2019-09-13 12:30 ` Martin Liška [this message]
2019-09-16 6:45 ` Richard Biener
2019-08-16 11:53 ` [PATCH 10/N] Use const_tree more in IPA ICF Martin Liška
2019-08-19 13:57 ` Richard Biener
2019-10-30 11:54 ` [PATCH 0/9] IPA ICF overhaul Martin Liška
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=73160761-cd59-9dc1-9a8d-b274c00eb2ba@suse.cz \
--to=mliska@suse.cz \
--cc=gcc-patches@gcc.gnu.org \
--cc=hubicka@ucw.cz \
--cc=richard.guenther@gmail.com \
/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).