public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Sebastian Pop <s.pop@samsung.com>
To: gcc-patches@gcc.gnu.org
Cc: sebpop@gmail.com,	aditya.k7@samsung.com,	tobias@grosser.es,
	richard.guenther@gmail.com,	Sebastian Pop <s.pop@samsung.com>
Subject: [PATCH] correctly handle non affine data references
Date: Thu, 01 Oct 2015 16:31:00 -0000	[thread overview]
Message-ID: <1443717113-5975-1-git-send-email-s.pop@samsung.com> (raw)

        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

             reply	other threads:[~2015-10-01 16:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-01 16:31 Sebastian Pop [this message]
2015-10-01 18:50 ` Tobias Grosser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1443717113-5975-1-git-send-email-s.pop@samsung.com \
    --to=s.pop@samsung.com \
    --cc=aditya.k7@samsung.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    --cc=sebpop@gmail.com \
    --cc=tobias@grosser.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).