public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Make alias_sets_conflict_p less conservative
@ 2008-03-04 20:59 Richard Guenther
  2008-03-04 23:54 ` Richard Kenner
  0 siblings, 1 reply; 42+ messages in thread
From: Richard Guenther @ 2008-03-04 20:59 UTC (permalink / raw)
  To: gcc-patches; +Cc: kenner


This makes alias_sets_conflict_p less conservative.  rev 34373 (Kenner)
added a check that makes a structure containing a member with alias
set zero alias everything.  Which IMHO is non-obvious and pessimizes
for example the testcase in PR27799.  Richard, can you explain this
change?

I'll bootstrap and test this, but posted for enlightening comments early.
(I can imagine latent bugs that make this necessary, but not a
fundamental alias rule?)

Thanks,
Richard.

2008-03-04  Richard Guenther  <rguenther@suse.de>

	PR middle-end/27799
	* alias.c (alias_sets_conflict_p): A alias set zero member
	in a structure does not mean the structure aliases with
	everything.

	* gcc.dg/alias-2.c: Adjust.
	* gcc.dg/alias-12.c: New testcase.

Index: alias.c
===================================================================
*** alias.c	(revision 132816)
--- alias.c	(working copy)
*************** alias_sets_conflict_p (alias_set_type se
*** 325,341 ****
    /* See if the first alias set is a subset of the second.  */
    ase = get_alias_set_entry (set1);
    if (ase != 0
!       && (ase->has_zero_child
! 	  || splay_tree_lookup (ase->children,
! 				(splay_tree_key) set2)))
      return 1;
  
    /* Now do the same, but with the alias sets reversed.  */
    ase = get_alias_set_entry (set2);
    if (ase != 0
!       && (ase->has_zero_child
! 	  || splay_tree_lookup (ase->children,
! 				(splay_tree_key) set1)))
      return 1;
  
    /* The two alias sets are distinct and neither one is the
--- 325,339 ----
    /* See if the first alias set is a subset of the second.  */
    ase = get_alias_set_entry (set1);
    if (ase != 0
!       && splay_tree_lookup (ase->children,
! 			    (splay_tree_key) set2))
      return 1;
  
    /* Now do the same, but with the alias sets reversed.  */
    ase = get_alias_set_entry (set2);
    if (ase != 0
!       && splay_tree_lookup (ase->children,
! 			    (splay_tree_key) set1))
      return 1;
  
    /* The two alias sets are distinct and neither one is the
Index: testsuite/gcc.dg/alias-2.c
===================================================================
*** testsuite/gcc.dg/alias-2.c	(revision 132816)
--- testsuite/gcc.dg/alias-2.c	(working copy)
*************** struct foo {
*** 11,16 ****
  int
  sub1 (long long int foobar)
  {
!   struct foo *tmp = (struct foo *) &foobar; // { dg-warning "type-punned pointer might" "" }
    return tmp->i;
  }
--- 11,16 ----
  int
  sub1 (long long int foobar)
  {
!   struct foo *tmp = (struct foo *) &foobar; // { dg-warning "type-punned pointer will" "" }
    return tmp->i;
  }
Index: testsuite/gcc.dg/alias-12.c
===================================================================
*** testsuite/gcc.dg/alias-12.c	(revision 0)
--- testsuite/gcc.dg/alias-12.c	(revision 0)
***************
*** 0 ****
--- 1,27 ----
+ /* { dg-do compile } */
+ /* { dg-options "-O2 -fdump-tree-optimized" } */
+ 
+ extern void abort (void);
+ 
+ struct X {double m; int x;};
+ struct Y {int y; short d;};
+ struct YY {int y; short d; char c;};
+ 
+ int foo(struct X *x,  struct Y *y)
+ {
+   x->x =  0;
+   y->y =  1;
+   if (x->x != 0)
+     abort ();
+ }
+ 
+ int foo_no(struct X *x,  struct YY *y)
+ {
+   x->x =  0;
+   y->y =  1;
+   if (x->x != 0)
+     abort ();
+ }
+ 
+ /* { dg-final { scan-tree-dump-not "abort" "optimized" } } */
+ /* { dg-final { cleanup-tree-dump "optimized" } } */

^ permalink raw reply	[flat|nested] 42+ messages in thread

end of thread, other threads:[~2008-03-20  2:01 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-04 20:59 [PATCH] Make alias_sets_conflict_p less conservative Richard Guenther
2008-03-04 23:54 ` Richard Kenner
2008-03-05  0:20   ` Daniel Berlin
2008-03-05  1:35     ` Richard Kenner
2008-03-05 10:00       ` Richard Guenther
2008-03-05 11:10         ` Paolo Bonzini
2008-03-05 11:17           ` Eric Botcazou
2008-03-05 12:05             ` Paolo Bonzini
2008-03-05 12:09               ` Eric Botcazou
2008-03-05 12:29               ` Richard Kenner
2008-03-05 11:31         ` Richard Kenner
2008-03-05 11:47           ` Richard Guenther
2008-03-05 12:25             ` Richard Kenner
2008-03-05 12:42               ` Richard Guenther
2008-03-05 12:55                 ` Richard Kenner
2008-03-05 14:07                   ` Richard Guenther
2008-03-05 14:24                     ` Richard Kenner
2008-03-05 15:01                       ` Richard Guenther
2008-03-05 15:13                         ` Richard Kenner
2008-03-05 15:21                           ` Richard Guenther
2008-03-05 15:29                             ` Michael Matz
2008-03-05 15:38                               ` Richard Guenther
2008-03-05 15:42                                 ` Richard Kenner
2008-03-05 15:52                                   ` Richard Guenther
2008-03-05 15:59                                     ` Richard Kenner
2008-03-05 16:07                                       ` Richard Guenther
2008-03-05 16:13                                         ` Richard Kenner
2008-03-05 16:17                                           ` Richard Guenther
2008-03-05 16:21                                             ` Richard Guenther
2008-03-05 16:55                                               ` Daniel Berlin
2008-03-05 16:55                                                 ` Richard Guenther
2008-03-05 17:00                                                   ` Daniel Berlin
2008-03-05 16:23                                             ` Richard Kenner
2008-03-05 16:27                                               ` Richard Guenther
2008-03-05 16:28                                                 ` Richard Kenner
2008-03-05 16:57                                                   ` Daniel Berlin
2008-03-05 15:18                       ` Michael Matz
2008-03-05 15:28                         ` Richard Kenner
2008-03-05  9:21   ` Richard Guenther
2008-03-05 11:29     ` Richard Kenner
2008-03-20  7:09       ` Mark Mitchell
2008-03-05 14:10     ` Richard Guenther

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).