Handle restrict pointer references as restrict in AA
authorTom de Vries <tom@codesourcery.com>
Tue, 22 Sep 2015 14:14:56 +0000 (14:14 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Tue, 22 Sep 2015 14:14:56 +0000 (14:14 +0000)
2015-09-22  Tom de Vries  <tom@codesourcery.com>

PR tree-optimization/67671
* tree-ssa-structalias.c (create_variable_info_for_1): Handle restrict
pointer references as restrict.

* g++.dg/pr67671.C: New test.

From-SVN: r228015

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/pr67671.C [new file with mode: 0644]
gcc/tree-ssa-structalias.c

index 7eb8b6dbf7f408abf16db12d1d6d816c043aff8b..95db04796a7260d6bea702873f1e46fb502c2b84 100644 (file)
@@ -1,3 +1,9 @@
+2015-09-22  Tom de Vries  <tom@codesourcery.com>
+
+       PR tree-optimization/67671
+       * tree-ssa-structalias.c (create_variable_info_for_1): Handle restrict
+       pointer references as restrict.
+
 2015-09-22  Chung-Lin Tang  <cltang@codesourcery.com>
 
        * config/nios2/nios2.c (nios2_legitimize_address): When handling
index 9c9bc5a44e4afb6644eefe8b9b973271d66fdd45..bcd04a03bd3c81333273b54e2f644d81a21dda1c 100644 (file)
@@ -1,3 +1,8 @@
+2015-09-22  Tom de Vries  <tom@codesourcery.com>
+
+       PR tree-optimization/67671
+       * g++.dg/pr67671.C: New test.
+
 2015-09-22  Alexander Fomin <alexander.fomin@intel.com>
 
        PR target/67480
diff --git a/gcc/testsuite/g++.dg/pr67671.C b/gcc/testsuite/g++.dg/pr67671.C
new file mode 100644 (file)
index 0000000..952ea4f
--- /dev/null
@@ -0,0 +1,12 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdump-tree-ealias-all" }
+
+void
+f (int *__restrict__ &__restrict__ p)
+{
+  *p = 1;
+}
+
+// { dg-final { scan-tree-dump-times "clique 1 base 1" 1 "ealias" } }
+// { dg-final { scan-tree-dump-times "clique 1 base 2" 1 "ealias" } }
+// { dg-final { scan-tree-dump-times "(?n)clique .* base .*" 2 "ealias" } }
index 66772cdfd5f38857a31e26d95a62b0eafe025878..1767b0435d72770174495eaeaa542a50f2e1faee 100644 (file)
@@ -5684,6 +5684,9 @@ create_variable_info_for_1 (tree decl, const char *name)
       vi->fullsize = tree_to_uhwi (declsize);
       vi->size = vi->fullsize;
       vi->is_full_var = true;
+      if (POINTER_TYPE_P (TREE_TYPE (decl))
+         && TYPE_RESTRICT (TREE_TYPE (decl)))
+       vi->only_restrict_pointers = 1;
       fieldstack.release ();
       return vi;
     }