OSDN Git Service

2008-04-23 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 23 Apr 2008 14:08:25 +0000 (14:08 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 23 Apr 2008 14:08:25 +0000 (14:08 +0000)
PR tree-optimization/27799
PR tree-optimization/32921
PR tree-optimization/32624
* tree-ssa-structalias.c (merge_smts_into): Only merge the
SMTs aliases and the tag itself into the solution.
* tree-ssa-alias.c (compute_flow_sensitive_aliasing): Do not
merge the points-to solution back into the SMT aliases.
(may_alias_p): Use alias_set_subset_of instead of
aliases_conflict_p.  A pointer which points to
memory with alias set zero may access any variable.

* gcc.dg/tree-ssa/pr27799.c: New testcase.
* gcc.dg/tree-ssa/20030807-7.c: Remove xfail, scan vrp dump.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@134598 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/20030807-7.c
gcc/testsuite/gcc.dg/tree-ssa/pr27799.c [new file with mode: 0644]
gcc/tree-ssa-alias.c
gcc/tree-ssa-structalias.c

index a774a43..4fdb849 100644 (file)
@@ -1,5 +1,18 @@
 2008-04-23  Richard Guenther  <rguenther@suse.de>
 
+       PR tree-optimization/27799
+       PR tree-optimization/32921
+       PR tree-optimization/32624
+       * tree-ssa-structalias.c (merge_smts_into): Only merge the
+       SMTs aliases and the tag itself into the solution.
+       * tree-ssa-alias.c (compute_flow_sensitive_aliasing): Do not
+       merge the points-to solution back into the SMT aliases.
+       (may_alias_p): Use alias_set_subset_of instead of
+       aliases_conflict_p.  A pointer which points to
+       memory with alias set zero may access any variable.
+
+2008-04-23  Richard Guenther  <rguenther@suse.de>
+
        * alias.c (alias_set_subset_of): Correctly handle asking
        if zero is a subset of an alias set with zero child.
        * tree-ssa-alias.c (have_common_aliases_p): Simplify logic.
index d5828e8..82b6042 100644 (file)
@@ -1,5 +1,13 @@
 2008-04-23  Richard Guenther  <rguenther@suse.de>
 
+       PR tree-optimization/27799
+       PR tree-optimization/32921
+       PR tree-optimization/32624
+       * gcc.dg/tree-ssa/pr27799.c: New testcase.
+       * gcc.dg/tree-ssa/20030807-7.c: Remove xfail, scan vrp dump.
+
+2008-04-23  Richard Guenther  <rguenther@suse.de>
+
        PR middle-end/36021
        * gcc.dg/attr-alloc_size-2.c: New testcase.
 
index 253c27a..f9f5fb7 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-dom3" } */
+/* { dg-options "-O2 -fdump-tree-vrp1" } */
   
 extern void abort (void);
 
@@ -32,7 +32,6 @@ simplify_condition (cond_p)
   c_simplify_stmt (&decl);
 }
 
-/* There should be exactly one IF conditional.  TBAA is not able to 
-   determine that 'decl' and 'cond' can't alias.  */
-/* { dg-final { scan-tree-dump-times "if " 1 "dom3" { xfail *-*-* } } } */
-/* { dg-final { cleanup-tree-dump "dom3" } } */
+/* There should be exactly one IF conditional.  */
+/* { dg-final { scan-tree-dump-times "if " 1 "vrp1" } } */
+/* { dg-final { cleanup-tree-dump "vrp1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr27799.c b/gcc/testsuite/gcc.dg/tree-ssa/pr27799.c
new file mode 100644 (file)
index 0000000..de09a40
--- /dev/null
@@ -0,0 +1,26 @@
+/* { dg-do link } */
+/* { dg-options "-O2" } */
+
+struct X { double m; int x; };
+struct Y { int y; short d; };
+struct YY { int y; short d; char c; };
+
+extern void link_error (void);
+
+int foo(struct X *x,  struct Y *y)
+{
+  x->x =  0;
+  y->y =  1;
+  if (x->x != 0)
+    link_error ();
+}
+
+int foo_no(struct X *x,  struct YY *y)
+{
+  x->x =  0;
+  y->y =  1;
+  if (x->x != 0)
+    link_error ();
+}
+
+int main() {}
index eb57010..ecc827a 100644 (file)
@@ -2354,7 +2354,6 @@ compute_flow_sensitive_aliasing (struct alias_info *ai)
   for (i = 0; VEC_iterate (tree, ai->processed_ptrs, i, ptr); i++)
     {
       struct ptr_info_def *pi = SSA_NAME_PTR_INFO (ptr);
-      tree tag = symbol_mem_tag (SSA_NAME_VAR (ptr));
 
       /* Set up aliasing information for PTR's name memory tag (if it has
         one).  Note that only pointers that have been dereferenced will
@@ -2362,18 +2361,7 @@ compute_flow_sensitive_aliasing (struct alias_info *ai)
       if (pi->name_mem_tag && pi->pt_vars)
        {
          if (!bitmap_empty_p (pi->pt_vars))
-           {
-             union_alias_set_into (pi->name_mem_tag, pi->pt_vars);
-             union_alias_set_into (tag, pi->pt_vars);
-             bitmap_clear_bit (MTAG_ALIASES (tag), DECL_UID (tag));
-           
-             /* It may be the case that this the tag uid was the only
-                bit we had set in the aliases list, and in this case,
-                we don't want to keep an empty bitmap, as this
-                asserts in tree-ssa-operands.c .  */
-             if (bitmap_empty_p (MTAG_ALIASES (tag)))
-               BITMAP_FREE (MTAG_ALIASES (tag));
-           }
+           union_alias_set_into (pi->name_mem_tag, pi->pt_vars);
        }
     }
   timevar_pop (TV_FLOW_SENSITIVE);
@@ -2860,8 +2848,19 @@ may_alias_p (tree ptr, alias_set_type mem_alias_set,
     {
       alias_stats.tbaa_queries++;
 
+      /* If the pointed to memory has alias set zero or the pointer
+        is ref-all, the MEM can alias VAR.  */
+      if (mem_alias_set == 0
+         || PTR_IS_REF_ALL (ptr))
+       {
+         alias_stats.alias_mayalias++;
+         alias_stats.tbaa_resolved++;
+         return true;
+       }
+
       /* If the alias sets don't conflict then MEM cannot alias VAR.  */
-      if (!alias_sets_conflict_p (mem_alias_set, var_alias_set))
+      if (mem_alias_set != var_alias_set
+         && !alias_set_subset_of (mem_alias_set, var_alias_set))
        {
          alias_stats.alias_noalias++;
          alias_stats.tbaa_resolved++;
index 5323a2b..9a8afb7 100644 (file)
@@ -4861,8 +4861,6 @@ set_used_smts (void)
 static void
 merge_smts_into (tree p, bitmap solution)
 {
-  unsigned int i;
-  bitmap_iterator bi;
   tree smt;
   bitmap aliases;
   tree var = p;
@@ -4873,20 +4871,8 @@ merge_smts_into (tree p, bitmap solution)
   smt = var_ann (var)->symbol_mem_tag;
   if (smt)
     {
-      alias_set_type smtset = get_alias_set (TREE_TYPE (smt));
-
-      /* Need to set the SMT subsets first before this
-        will work properly.  */
+      /* The smt itself isn't included in its aliases.  */
       bitmap_set_bit (solution, DECL_UID (smt));
-      EXECUTE_IF_SET_IN_BITMAP (used_smts, 0, i, bi)
-       {
-         tree newsmt = referenced_var (i);
-         tree newsmttype = TREE_TYPE (newsmt);
-
-         if (alias_set_subset_of (get_alias_set (newsmttype),
-                                  smtset))
-           bitmap_set_bit (solution, i);
-       }
 
       aliases = MTAG_ALIASES (smt);
       if (aliases)