From patchwork Thu Oct 1 16:31:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Pop X-Patchwork-Id: 525170 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0A7BD14016A for ; Fri, 2 Oct 2015 02:32:03 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=A18C2j/b; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=PPbCOcFNu1KI fCZS6X9fpRQMF3+h6booH8lA9rdlJgzdklYryB/u1eWK0SqzHPkPZA/MuFkW6iMk T4FK3N0+kOLQ7Mts9EnwM+oba+bc12HAKCOR35ga8+gvlyPVV2gbTAz2ncuiiMo+ xmW8guU8PpdiwdhKbOvQckXVc7z821s= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; s=default; bh=Z0cWuCVDfmSCOHw7pB GAYaLkzbs=; b=A18C2j/btxbjR5lvQqGoC+M0v91eS6fWqjWs+70q5PLiP7OgsY +iw0oejUp3XpklUNKm7Hih8jYC3t9TrdGtmCEauLtCLBQ4ed0iqgmCS3+RgJHI/q Onf6bzkfzAOCntQk8RKDCXgKhLympxxWZOe49fWZhpN4T3ggypnRIaslU= Received: (qmail 123742 invoked by alias); 1 Oct 2015 16:31:57 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 123722 invoked by uid 89); 1 Oct 2015 16:31:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.4 required=5.0 tests=AWL, BAYES_50, KAM_LAZY_DOMAIN_SECURITY, TVD_RCVD_IP autolearn=no version=3.3.2 X-HELO: mailhost.sarc.sas Received: from 72-48-121-251.static.grandenetworks.net (HELO mailhost.sarc.sas) (72.48.121.251) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 01 Oct 2015 16:31:55 +0000 Received: from cc00.spa.sarc.sas (cc00.spa.sarc.sas [172.31.207.192]) by mailhost.sarc.sas (Postfix) with ESMTP id 4816F2E118; Thu, 1 Oct 2015 11:31:54 -0500 (CDT) Received: by cc00.spa.sarc.sas (Postfix, from userid 12626) id 3C96B12004F; Thu, 1 Oct 2015 11:31:54 -0500 (CDT) From: Sebastian Pop To: gcc-patches@gcc.gnu.org Cc: sebpop@gmail.com, aditya.k7@samsung.com, tobias@grosser.es, richard.guenther@gmail.com, Sebastian Pop Subject: [PATCH] correctly handle non affine data references Date: Thu, 1 Oct 2015 11:31:53 -0500 Message-Id: <1443717113-5975-1-git-send-email-s.pop@samsung.com> 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 *-*-* } } } */