re PR c/48885 (missed optimization with restrict qualifier?)
authorRichard Biener <rguenther@suse.de>
Thu, 24 Sep 2015 07:34:47 +0000 (07:34 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 24 Sep 2015 07:34:47 +0000 (07:34 +0000)
2015-09-24  Richard Biener  <rguenther@suse.de>

PR tree-optimization/48885
* tree-ssa-structalias.c (visit_loadstore): Handle default defs
as not including any restrict tags from other pointers.

* gcc.dg/tree-ssa/restrict-6.c: New testcase.

From-SVN: r228073

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/restrict-6.c [new file with mode: 0644]
gcc/tree-ssa-structalias.c

index c9eb9afd30c8ecc4d55a40f0d84707c9ff599c2c..5ae3e4436af36714dd403cfd6d51865b7d2aca16 100644 (file)
@@ -1,3 +1,9 @@
+2015-09-24  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/48885
+       * tree-ssa-structalias.c (visit_loadstore): Handle default defs
+       as not including any restrict tags from other pointers.
+
 2015-09-23  Thomas Schwinge  <thomas@codesourcery.com>
 
        * gcc.c (handle_foffload_option): Don't lose the trailing NUL
index bf0e13a0cefa6c2d13d6e99d2fa76214e56582ad..1d9b87273e9c1fdd6f50b8484c303f5dfb12453b 100644 (file)
@@ -1,3 +1,8 @@
+2015-09-24  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/48885
+       * gcc.dg/tree-ssa/restrict-6.c: New testcase.
+
 2015-09-24  Patrick Palka  <ppalka@gcc.gnu.org>
 
        * c-c++-common/Wmisleading-indentation.c: Augment test.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/restrict-6.c b/gcc/testsuite/gcc.dg/tree-ssa/restrict-6.c
new file mode 100644 (file)
index 0000000..7c5ed01
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-fre1" } */
+
+void
+test (int *a, int *b, int * __restrict__ v)
+{
+  *a = *v;
+  *b = *v;
+}
+
+/* { dg-final { scan-tree-dump-times "= \\*v" 1 "fre1" } } */
index 8d81bd4f730525a1ffe7a195916d0c80d784db8a..8d86dcbf0ccc92fcb87f8ef36a78fc161f74cd63 100644 (file)
@@ -6952,10 +6952,11 @@ visit_loadstore (gimple *, tree base, tree ref, void *clique_)
       || TREE_CODE (base) == TARGET_MEM_REF)
     {
       tree ptr = TREE_OPERAND (base, 0);
-      if (TREE_CODE (ptr) == SSA_NAME)
+      if (TREE_CODE (ptr) == SSA_NAME
+         && ! SSA_NAME_IS_DEFAULT_DEF (ptr))
        {
          /* ???  We need to make sure 'ptr' doesn't include any of
-            the restrict tags in its points-to set.  */
+            the restrict tags we added bases for in its points-to set.  */
          return false;
        }