aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Pop <s.pop@samsung.com>2015-10-01 22:04:07 +0000
committerSebastian Pop <spop@gcc.gnu.org>2015-10-01 22:04:07 +0000
commit6652875ffe9269a326cf7b3f17e7446079ba11d5 (patch)
tree9f9c9d54c9b0c45af12b0aec49b6b0859091b145
parent55fec44def29854be875ac68c304fc0c55b538ff (diff)
downloadgcc-6652875ffe9269a326cf7b3f17e7446079ba11d5.zip
gcc-6652875ffe9269a326cf7b3f17e7446079ba11d5.tar.gz
gcc-6652875ffe9269a326cf7b3f17e7446079ba11d5.tar.bz2
correctly handle non affine data references
2015-10-01 Sebastian Pop <s.pop@samsung.com> Aditya Kumar <aditya.k7@samsung.com> PR tree-optimization/66980 * graphite-scop-detection.c (stmt_has_simple_data_refs_p): Return false when data reference analysis has failed. Co-Authored-By: Aditya Kumar <aditya.k7@samsung.com> From-SVN: r228357
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/graphite-scop-detection.c7
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-pr66980.c10
3 files changed, 24 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 91b417a..2bdec1c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,6 +1,13 @@
2015-10-01 Sebastian Pop <s.pop@samsung.com>
Aditya Kumar <aditya.k7@samsung.com>
+ PR tree-optimization/66980
+ * graphite-scop-detection.c (stmt_has_simple_data_refs_p): Return false
+ when data reference analysis has failed.
+
+2015-10-01 Sebastian Pop <s.pop@samsung.com>
+ Aditya Kumar <aditya.k7@samsung.com>
+
PR tree-optimization/67754
* graphite-scop-detection.c (stmt_has_simple_data_refs_p): Call
scev analysis on the same loop nest as analyze_drs_in_stmts.
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index c45df55..dee4f86 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -274,6 +274,13 @@ stmt_has_simple_data_refs_p (sese_l scop, gimple *stmt)
FOR_EACH_VEC_ELT (drs, j, dr)
{
int nb_subscripts = DR_NUM_DIMENSIONS (dr);
+
+ if (nb_subscripts < 1)
+ {
+ free_data_refs (drs);
+ return false;
+ }
+
tree ref = DR_REF (dr);
for (int i = nb_subscripts - 1; i >= 0; i--)
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-pr66980.c b/gcc/testsuite/gcc.dg/graphite/scop-pr66980.c
new file mode 100644
index 0000000..cf93452
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/scop-pr66980.c
@@ -0,0 +1,10 @@
+void foo(unsigned char *in, unsigned char *out, int w, int h)
+{
+ unsigned int i, j;
+ for (i = 0; i < 3*w*h; i++)
+ for (j = 0; j < 3*w*h; j++)
+ out[i * w + j] = in[(i * w + j)*3] + in[(i * w + j)*3 + 1] + in[(i * w + j)*3 + 2];
+}
+
+/* Requires delinearization to be able to represent "i*w". */
+/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite" { xfail *-*-* } } } */