public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] correctly handle non affine data references
@ 2015-10-01 16:31 Sebastian Pop
  2015-10-01 18:50 ` Tobias Grosser
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Pop @ 2015-10-01 16:31 UTC (permalink / raw)
  To: gcc-patches; +Cc: sebpop, aditya.k7, tobias, richard.guenther, Sebastian Pop

        PR tree-optimization/66980
        * graphite-scop-detection.c (stmt_has_simple_data_refs_p): Return false
        when data reference analysis has failed.
---
 gcc/graphite-scop-detection.c                |  7 +++++++
 gcc/testsuite/gcc.dg/graphite/scop-pr66980.c | 10 ++++++++++
 2 files changed, 17 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/graphite/scop-pr66980.c

diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index c45df55..dee4f86d1 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 *-*-* } } } */
-- 
2.1.0.243.g30d45f7

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] correctly handle non affine data references
  2015-10-01 16:31 [PATCH] correctly handle non affine data references Sebastian Pop
@ 2015-10-01 18:50 ` Tobias Grosser
  0 siblings, 0 replies; 2+ messages in thread
From: Tobias Grosser @ 2015-10-01 18:50 UTC (permalink / raw)
  To: Sebastian Pop, gcc-patches; +Cc: sebpop, aditya.k7, richard.guenther

On 10/01/2015 06:31 PM, Sebastian Pop wrote:
>   create mode 100644 gcc/testsuite/gcc.dg/graphite/scop-pr66980.c
>
> diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c


LGTM.

Tobias

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-01 18:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-01 16:31 [PATCH] correctly handle non affine data references Sebastian Pop
2015-10-01 18:50 ` Tobias Grosser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).