From fe8b1e839ca91a61440288049a868944346eef4b Mon Sep 17 00:00:00 2001 From: Doug Gilmore Date: Tue, 4 Oct 2016 15:28:23 +0000 Subject: [PATCH] re PR tree-optimization/77808 (ICE in duplicate_ssa_name_ptr_info, at tree-ssanames.c:630 starting with r240439) 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 | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/tree-ssa/pr77808.c | 11 +++++++++++ gcc/tree-ssa-loop-prefetch.c | 3 ++- 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr77808.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 94c301d1a57..3be8781adbf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-10-04 Doug Gilmore + + 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 * config/i386/x86-tune.def (X86_TUNE_VECTORIZE_DOUBLE): Remove. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c6b9d87c5ab..41c2f381c86 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-10-04 Doug Gilmore + + PR tree-optimization/77808 + * gcc.dg/tree-ssa/pr77808.c: New testcase. + 2016-10-04 Richard Biener 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 index 00000000000..6c806ec9aca --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr77808.c @@ -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]; +} diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c index 056815de9e1..43ee85aae92 100644 --- a/gcc/tree-ssa-loop-prefetch.c +++ b/gcc/tree-ssa-loop-prefetch.c @@ -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));