re PR fortran/90738 (gfortran.dg/pointer_array_10.f90 etc. FAIL)
authorRichard Biener <rguenther@suse.de>
Tue, 4 Jun 2019 08:09:16 +0000 (08:09 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 4 Jun 2019 08:09:16 +0000 (08:09 +0000)
2019-06-04  Richard Biener  <rguenther@suse.de>

PR tree-optimization/90738
Revert
2019-06-03  Richard Biener  <rguenther@suse.de>

* tree-ssa-sccvn.c (ao_ref_init_from_vn_reference): Get original
full reference tree and record in ref->ref.
(vn_reference_lookup_3): Pass in original ref to
ao_ref_init_from_vn_reference.
(vn_reference_lookup): Likewise.
* tree-ssa-sccvn.h (ao_ref_init_from_vn_reference): Adjust prototype.
* tree-ssa-alias.c (nonoverlapping_component_refs_of_decl_p):
Handle non-decl bases in the original reference.

* gcc.dg/tree-ssa/alias-access-path-1.c: Scan fre1.

* gcc.dg/torture/pr90738.c: New testcase.

From-SVN: r271902

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr90738.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/alias-access-path-1.c
gcc/tree-ssa-alias.c
gcc/tree-ssa-sccvn.c
gcc/tree-ssa-sccvn.h

index d249d12ca5077d5960b73e9a82d840822df475d6..80d01ad526da51c5f42202242e51818144ebc514 100644 (file)
@@ -1,3 +1,18 @@
+2019-06-04  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/90738
+       Revert
+       2019-06-03  Richard Biener  <rguenther@suse.de>
+
+       * tree-ssa-sccvn.c (ao_ref_init_from_vn_reference): Get original
+       full reference tree and record in ref->ref.
+       (vn_reference_lookup_3): Pass in original ref to
+       ao_ref_init_from_vn_reference.
+       (vn_reference_lookup): Likewise.
+       * tree-ssa-sccvn.h (ao_ref_init_from_vn_reference): Adjust prototype.
+       * tree-ssa-alias.c (nonoverlapping_component_refs_of_decl_p):
+       Handle non-decl bases in the original reference.
+
 2019-06-04  Martin Liska  <mliska@suse.cz>
 
        * ipa-icf.c (sem_item_optimizer::add_item_to_class): Count
index 94dad4bd3bd1752b092893da1a2a585abba636e0..554bd22a66ece7c4caa95812f9295efad2b52d24 100644 (file)
@@ -1,3 +1,13 @@
+2019-06-04  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/90738
+       * gcc.dg/torture/pr90738.c: New testcase.
+
+       Revert
+       2019-06-03  Richard Biener  <rguenther@suse.de>
+
+       * gcc.dg/tree-ssa/alias-access-path-1.c: Scan fre1.
+
 2019-06-04  Martin Liska  <mliska@suse.cz>
 
        * c-c++-common/goacc/acc-icf.c: Change scanned pattern.
diff --git a/gcc/testsuite/gcc.dg/torture/pr90738.c b/gcc/testsuite/gcc.dg/torture/pr90738.c
new file mode 100644 (file)
index 0000000..b457dd5
--- /dev/null
@@ -0,0 +1,20 @@
+/* { dg-do run } */
+
+int __attribute__((noipa,noinline))
+foo (int i)
+{
+  int a[2];
+  a[1] = 1;
+  int j = a[1];
+  int *p = &a[0];
+  p[i] = 0;
+  return a[j];
+}
+
+int
+main()
+{
+  if (foo (1) != 0)
+    __builtin_abort ();
+  return 0;
+}
index 63722a5d0fd2a7aec3f4a62e9b96cf308e858d5b..264f72aff0a749768d26773de4f5448baae9b30d 100644 (file)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-fre1 -fno-tree-sra" } */
-
+/* { dg-options "-O2 -fdump-tree-fre3 -fno-tree-sra" } */
 struct foo
 {
   int val;
@@ -19,4 +18,4 @@ test ()
   return barptr->val2;
 }
 
-/* { dg-final { scan-tree-dump-times "return 123" 1 "fre1"} } */
+/* { dg-final { scan-tree-dump-times "return 123" 1 "fre3"} } */
index dd4e3b7aaa9e5d58508a6c7c70a3b74dc6ddc1dc..429288b6ca523a7ed09267e651e3a35d8d53479f 100644 (file)
@@ -1013,8 +1013,7 @@ nonoverlapping_component_refs_of_decl_p (tree ref1, tree ref2)
     }
   if (TREE_CODE (ref1) == MEM_REF)
     {
-      if (!integer_zerop (TREE_OPERAND (ref1, 1))
-         || TREE_CODE (TREE_OPERAND (ref1, 0)) != ADDR_EXPR)
+      if (!integer_zerop (TREE_OPERAND (ref1, 1)))
        return false;
       ref1 = TREE_OPERAND (TREE_OPERAND (ref1, 0), 0);
     }
@@ -1027,8 +1026,7 @@ nonoverlapping_component_refs_of_decl_p (tree ref1, tree ref2)
     }
   if (TREE_CODE (ref2) == MEM_REF)
     {
-      if (!integer_zerop (TREE_OPERAND (ref2, 1))
-         || TREE_CODE (TREE_OPERAND (ref2, 0)) != ADDR_EXPR)
+      if (!integer_zerop (TREE_OPERAND (ref2, 1)))
        return false;
       ref2 = TREE_OPERAND (TREE_OPERAND (ref2, 0), 0);
     }
index 8c0c8b2c56674bd43ccffbb1b00f1916d9b07db5..b4f626000dd01c759c4f11180c4029cd2a6910ff 100644 (file)
@@ -995,7 +995,7 @@ copy_reference_ops_from_ref (tree ref, vec<vn_reference_op_s> *result)
 bool
 ao_ref_init_from_vn_reference (ao_ref *ref,
                               alias_set_type set, tree type,
-                              vec<vn_reference_op_s> ops, tree orig_ref)
+                              vec<vn_reference_op_s> ops)
 {
   vn_reference_op_t op;
   unsigned i;
@@ -1149,7 +1149,7 @@ ao_ref_init_from_vn_reference (ao_ref *ref,
   if (base == NULL_TREE)
     return false;
 
-  ref->ref = orig_ref;
+  ref->ref = NULL_TREE;
   ref->base = base;
   ref->ref_alias_set = set;
   if (base_alias_set != -1)
@@ -1976,8 +1976,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_,
        {
          lhs_ref_ok = ao_ref_init_from_vn_reference (&lhs_ref,
                                                      get_alias_set (lhs),
-                                                     TREE_TYPE (lhs), lhs_ops,
-                                                     lhs);
+                                                     TREE_TYPE (lhs), lhs_ops);
          if (lhs_ref_ok
              && !refs_may_alias_p_1 (ref, &lhs_ref, true))
            {
@@ -2719,7 +2718,7 @@ vn_reference_lookup (tree op, tree vuse, vn_lookup_kind kind,
          Otherwise preserve the full reference for advanced TBAA.  */
       if (!valuezied_anything
          || !ao_ref_init_from_vn_reference (&r, vr1.set, vr1.type,
-                                            vr1.operands, op))
+                                            vr1.operands))
        ao_ref_init (&r, op);
       if (! tbaa_p)
        r.ref_alias_set = r.base_alias_set = 0;
index ec32dcb499005997d11c3bff48c65375e001d381..bd661bc651c43ce75ed0ca2604f1026a04cf99a5 100644 (file)
@@ -229,7 +229,7 @@ vn_nary_op_t vn_nary_op_insert (tree, tree);
 vn_nary_op_t vn_nary_op_insert_pieces (unsigned int, enum tree_code,
                                       tree, tree *, tree, unsigned int);
 bool ao_ref_init_from_vn_reference (ao_ref *, alias_set_type, tree,
-                                   vec<vn_reference_op_s>, tree = NULL_TREE);
+                                   vec<vn_reference_op_s> );
 vec<vn_reference_op_s> vn_reference_operands_for_lookup (tree);
 tree vn_reference_lookup_pieces (tree, alias_set_type, tree,
                                 vec<vn_reference_op_s> ,