public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Liska <mliska@suse.cz>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH 9/9] Remove alias set comparison.
Date: Tue, 06 Aug 2019 15:43:00 -0000	[thread overview]
Message-ID: <91e6b40a92a78aba00fe73f307882430ed474032.1565105737.git.mliska@suse.cz> (raw)
In-Reply-To: <cover.1565105736.git.mliska@suse.cz>

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


gcc/ChangeLog:

2019-07-24  Martin Liska  <mliska@suse.cz>

	* ipa-icf-gimple.c (func_checker::compatible_types_p):
	Do not compare alias sets.  It's handled by operand_equal_p.

gcc/testsuite/ChangeLog:

2019-07-24  Martin Liska  <mliska@suse.cz>

	* c-c++-common/Wstringop-truncation-4.c: Disable IPA ICF.
	* gcc.dg/tree-ssa/pr64910-2.c: Likewise.
	* gcc.dg/tree-ssa/pr79352.c: Likewise.
	* gcc.dg/ipa/ipa-icf-40.c: New test.
---
 gcc/ipa-icf-gimple.c                          | 12 -------
 .../c-c++-common/Wstringop-truncation-4.c     |  2 +-
 gcc/testsuite/gcc.dg/ipa/ipa-icf-40.c         | 32 +++++++++++++++++++
 gcc/testsuite/gcc.dg/tree-ssa/pr64910-2.c     |  2 +-
 gcc/testsuite/gcc.dg/tree-ssa/pr79352.c       |  2 +-
 5 files changed, 35 insertions(+), 15 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/ipa/ipa-icf-40.c


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0009-Remove-alias-set-comparison.patch --]
[-- Type: text/x-patch; name="0009-Remove-alias-set-comparison.patch", Size: 3783 bytes --]

diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c
index 375aadad412..751d5859706 100644
--- a/gcc/ipa-icf-gimple.c
+++ b/gcc/ipa-icf-gimple.c
@@ -31,7 +31,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "cgraph.h"
 #include "data-streamer.h"
 #include "gimple-pretty-print.h"
-#include "alias.h"
 #include "fold-const.h"
 #include "gimple-iterator.h"
 #include "ipa-utils.h"
@@ -209,17 +208,6 @@ func_checker::compatible_types_p (tree t1, tree t2)
   if (!types_compatible_p (t1, t2))
     return return_false_with_msg ("types are not compatible");
 
-  /* We do a lot of unnecesary matching of types that are not being
-     accessed and thus do not need to be compatible.  In longer term we should
-     remove these checks on all types which are not accessed as memory
-     locations.
-
-     For time being just avoid calling get_alias_set on types that are not
-     having alias sets defined at all.  */
-  if (type_with_alias_set_p (t1) && type_with_alias_set_p (t2)
-      && get_alias_set (t1) != get_alias_set (t2))
-    return return_false_with_msg ("alias sets are different");
-
   return true;
 }
 
diff --git a/gcc/testsuite/c-c++-common/Wstringop-truncation-4.c b/gcc/testsuite/c-c++-common/Wstringop-truncation-4.c
index c76f2823daf..15209536add 100644
--- a/gcc/testsuite/c-c++-common/Wstringop-truncation-4.c
+++ b/gcc/testsuite/c-c++-common/Wstringop-truncation-4.c
@@ -3,7 +3,7 @@
    Verify that -Wstringop-truncation is issued for uses of arrays and
    pointers to qualified forms of characters of all three types.
    { dg-do compile }
-   { dg-options "-O2 -Wall -Wstringop-truncation" } */
+   { dg-options "-O2 -Wall -Wstringop-truncation -fno-ipa-icf" } */
 
 #if __cplusplus
 extern "C"
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-icf-40.c b/gcc/testsuite/gcc.dg/ipa/ipa-icf-40.c
new file mode 100644
index 00000000000..8d512cbc7d3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-icf-40.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-ipa-icf"  } */
+
+struct A { int i; char a1[10]; };
+struct B { int i; char a3[30]; };
+struct C { int i; char ax[]; };
+
+static int
+__attribute__((noinline))
+test_array_1 (int i, struct A *a)
+{
+  return __builtin_printf ("%-s\n", a->a1);
+}
+
+static int
+__attribute__((noinline))
+test_array_3 (int i, struct B *b)
+{
+  return __builtin_printf ("%-s\n", b->a3);
+}
+
+struct A a = { 0, "foo" };
+struct B b = { 0, "bar" };
+
+int main()
+{
+  test_array_1 (0, &a);
+  test_array_3 (0, &b);
+  return 0;
+}
+
+/* { dg-final { scan-ipa-dump "Equal symbols: 1" "icf"  } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr64910-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr64910-2.c
index 2e3d6790776..812bfa48825 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr64910-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr64910-2.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-reassoc1" } */
+/* { dg-options "-O2 -fdump-tree-reassoc1 -fno-ipa-icf" } */
 
 /* We want to make sure that we reassociate in a way that has the
    constant last.  With the constant last, it's more likely to result
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr79352.c b/gcc/testsuite/gcc.dg/tree-ssa/pr79352.c
index 485e2d64cb3..36e195c3a06 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr79352.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr79352.c
@@ -1,7 +1,7 @@
 /* PR tree-optimization/79352 - -fprintf-return-value doesn't handle
    flexible-like array members properly
    { dg-do compile }
-   { dg-options "-O2 -fdump-tree-optimized" } */
+   { dg-options "-O2 -fdump-tree-optimized -fno-ipa-icf" } */
 
 struct A { int i; char a1[1]; };
 struct B { int i; char a3[3]; };

  parent reply	other threads:[~2019-08-06 15:43 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 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 8/9] Remove comparison for polymorphic types Martin Liska
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               ` Martin Liska [this message]
2019-08-07 15:58                 ` [PATCH 9/9] Remove alias set comparison 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
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=91e6b40a92a78aba00fe73f307882430ed474032.1565105737.git.mliska@suse.cz \
    --to=mliska@suse.cz \
    --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).