From 6652875ffe9269a326cf7b3f17e7446079ba11d5 Mon Sep 17 00:00:00 2001 From: Sebastian Pop Date: Thu, 1 Oct 2015 22:04:07 +0000 Subject: [PATCH] correctly handle non affine data references 2015-10-01 Sebastian Pop Aditya Kumar 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 From-SVN: r228357 --- gcc/ChangeLog | 7 +++++++ gcc/graphite-scop-detection.c | 7 +++++++ gcc/testsuite/gcc.dg/graphite/scop-pr66980.c | 10 ++++++++++ 3 files changed, 24 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/graphite/scop-pr66980.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 91b417ad6c4..2bdec1ca4fa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-10-01 Sebastian Pop + Aditya Kumar + + 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 Aditya Kumar diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c index c45df5555de..dee4f86d130 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 00000000000..cf93452eb21 --- /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 *-*-* } } } */ -- 2.30.2