re PR tree-optimization/77808 (ICE in duplicate_ssa_name_ptr_info, at tree-ssanames...
authorDoug Gilmore <doug.gilmore@imgtec.com>
Tue, 4 Oct 2016 15:28:23 +0000 (15:28 +0000)
committerMatthew Fortune <mpf@gcc.gnu.org>
Tue, 4 Oct 2016 15:28:23 +0000 (15:28 +0000)
Fix PR tree-optimization/77808

gcc/
PR tree-optimization/77808
* tree-ssa-loop-prefetch.c (issue_prefetch_ref): Check base_addr
and addr are different before copying points-to information.

gcc/testsuite/
PR tree-optimization/77808
* gcc.dg/tree-ssa/pr77808.c: New testcase.

From-SVN: r240749

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/pr77808.c [new file with mode: 0644]
gcc/tree-ssa-loop-prefetch.c

index 94c301d1a57553709f00b38f952c9ef2dfef891a..3be8781adbfc5e5265c51208d4d08ddb75a377e9 100644 (file)
@@ -1,3 +1,9 @@
+2016-10-04  Doug Gilmore  <doug.gilmore@imgtec.com>
+
+       PR tree-optimization/77808
+       * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Check base_addr
+       and addr are different before copying points-to information.
+
 2016-10-04  Uros Bizjak  <ubizjak@gmail.com>
 
        * config/i386/x86-tune.def (X86_TUNE_VECTORIZE_DOUBLE): Remove.
index c6b9d87c5abaffdd5daab537b5c0f9b6a7859bcd..41c2f381c863d8045d3ad4d0f2501fc85009dfd1 100644 (file)
@@ -1,3 +1,8 @@
+2016-10-04  Doug Gilmore  <doug.gilmore@imgtec.com>
+
+       PR tree-optimization/77808
+       * gcc.dg/tree-ssa/pr77808.c: New testcase.
+
 2016-10-04  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/77399
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr77808.c b/gcc/testsuite/gcc.dg/tree-ssa/pr77808.c
new file mode 100644 (file)
index 0000000..6c806ec
--- /dev/null
@@ -0,0 +1,11 @@
+/* PR tree-optimization/77808 */
+/* { dg-options "-O2 -fprefetch-loop-arrays --param prefetch-latency=0 -w" } */
+
+void
+daxpy(int n, double da, double * __restrict dx, double * __restrict dy)
+{
+  int i;
+
+  for (i = 0;i < n; i++)
+    dy[i] = dy[i] + da*dx[i];
+}
index 056815de9e1fbdcc00e43ab896003c1958f08ebf..43ee85aae9229941f20abbe578e55b1241cc000a 100644 (file)
@@ -1162,7 +1162,8 @@ issue_prefetch_ref (struct mem_ref *ref, unsigned unroll_factor, unsigned ahead)
                                           NULL, true, GSI_SAME_STMT);
       }
 
-      if (TREE_CODE (addr_base) == SSA_NAME
+      if (addr_base != addr
+         && TREE_CODE (addr_base) == SSA_NAME
          && TREE_CODE (addr) == SSA_NAME)
        {
          duplicate_ssa_name_ptr_info (addr, SSA_NAME_PTR_INFO (addr_base));