From patchwork Tue Jan 12 18:18:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 566672 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 656A71402A1 for ; Wed, 13 Jan 2016 05:18:51 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=nLOlhhuW; 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=buSI7EGyduugcvgwu /f18t2qcMtpQmrW+D0UCUARWfeKtXKWe1Yb76YRg3ewCsAw18a+g8zPhxEH1L5l+ msce2QPUO+K5wCzy810AlkuX66Sy2VGg/VZbdgnHx4QdJWft2PZZhm+zFvr+5AkQ 3oZGDr0TXoPAIk2KEX0tGmT1YI= 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=QMRBQ7cCrU2XqHuKt019m2p KVgc=; b=nLOlhhuWEIAabYb26WG8QuLtM8ReHHP2ASI+xqCHP5foHmidulF9gs2 S2DNtyP5yeU9aTpNgN23m97p2SIcq47EZOMmbZNAkgUdCP1gHnKObT6EF0YC5jl4 nRju6kBQxkgtyZUGQGvut/2C1uI7tWZzWd/iwpI0CvTdJOljX1Og= Received: (qmail 63857 invoked by alias); 12 Jan 2016 18:18:41 -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 63827 invoked by uid 89); 12 Jan 2016 18:18:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=afaiu, AFAIU, sk:DR_NUM_, sk:dr_num_ X-HELO: fencepost.gnu.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (208.118.235.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 12 Jan 2016 18:18:34 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54345) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1aJ3Wa-0002Fj-2T for gcc-patches@gnu.org; Tue, 12 Jan 2016 13:18:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aJ3WW-0004Rd-FR for gcc-patches@gnu.org; Tue, 12 Jan 2016 13:18:31 -0500 Received: from relay1.mentorg.com ([192.94.38.131]:39764) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJ3WW-0004RS-6C for gcc-patches@gnu.org; Tue, 12 Jan 2016 13:18:28 -0500 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1aJ3WU-0000ET-CM from Tom_deVries@mentor.com ; Tue, 12 Jan 2016 10:18:26 -0800 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.3.224.2; Tue, 12 Jan 2016 18:18:25 +0000 Subject: Re: [PATCH, PR69110] Don't return NULL access_fns in dr_analyze_indices To: Richard Biener , Sebastian Pop References: <5694CF85.1020708@mentor.com> <5694F5BA.7030207@mentor.com> CC: "gcc-patches@gnu.org" From: Tom de Vries Message-ID: <5695436D.4000003@mentor.com> Date: Tue, 12 Jan 2016 19:18:21 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-Received-From: 192.94.38.131 On 12/01/16 14:04, Richard Biener wrote: > On Tue, 12 Jan 2016, Tom de Vries wrote: > >> On 12/01/16 12:22, Richard Biener wrote: >>> Doesnt' the same issue apply to >>> >>>>> unsigned int *p; >>>>> >>>>> static void __attribute__((noinline, noclone)) >>>>> foo (void) >>>>> { >>>>> unsigned int z; >>>>> >>>>> for (z = 0; z < N; ++z) >>>>> ++(*p); >>>>> } >>> thus when we have a MEM_REF[p_1]? SCEV will not analyze >>> its evolution to a POLYNOMIAL_CHREC and thus access_fns will >>> be NULL again. >>> >> >> I didn't manage to trigger this scenario, though I could probably make it >> happen by modifying ftree-loop-im to work in one case (the load of the value >> of p) but not the other (the *p load and store). >> >>> I think avoiding a NULL access_fns is ok but it should be done >>> unconditionally, not only for the DECL_P case. >> >> Ok, I'll retest and commit this patch. > > Please add a comment as well. Patch updated with comment. During testing however, I ran into two testsuite regressions: 1. -PASS: gfortran.dg/graphite/pr39516.f -O (test for excess errors) +FAIL: gfortran.dg/graphite/pr39516.f -O (internal compiler error) +FAIL: gfortran.dg/graphite/pr39516.f -O (test for excess errors) AFAIU, this is a duplicate of PR68976. Should I wait with committing the patch until PR68976 is fixed? 2. -XFAIL: gcc.dg/graphite/scop-pr66980.c scan-tree-dump-times graphite "number of SCoPs: 1" 1 +XPASS: gcc.dg/graphite/scop-pr66980.c scan-tree-dump-times graphite "number of SCoPs: 1" 1 AFAIU, this is not a real regression, but the testcase needs to be updated. I'm not sure how. Sebastian, perhaps you have an idea there? Thanks, - Tom From 24dfdb5a8a536203ad159bcbeaee6931be032f32 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Tue, 12 Jan 2016 01:45:11 +0100 Subject: [PATCH] Don't return NULL access_fns in dr_analyze_indices 2016-01-12 Tom de Vries * tree-data-ref.c (dr_analyze_indices): Don't return NULL access_fns. * gcc.dg/autopar/pr69110.c: New test. * testsuite/libgomp.c/pr69110.c: New test. --- gcc/testsuite/gcc.dg/autopar/pr69110.c | 19 +++++++++++++++++++ gcc/tree-data-ref.c | 4 ++++ libgomp/testsuite/libgomp.c/pr69110.c | 26 ++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/autopar/pr69110.c create mode 100644 libgomp/testsuite/libgomp.c/pr69110.c diff --git a/gcc/testsuite/gcc.dg/autopar/pr69110.c b/gcc/testsuite/gcc.dg/autopar/pr69110.c new file mode 100644 index 0000000..e236015 --- /dev/null +++ b/gcc/testsuite/gcc.dg/autopar/pr69110.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -ftree-parallelize-loops=2 -fno-tree-loop-im -fdump-tree-parloops-details" } */ + +#define N 1000 + +unsigned int i = 0; + +void +foo (void) +{ + unsigned int z; + for (z = 0; z < N; ++z) + ++i; +} + +/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 0 "parloops" } } */ +/* { dg-final { scan-tree-dump-times "FAILED: data dependencies exist across iterations" 1 "parloops" } } */ + + diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index a40f40d..7ff5db7 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -1023,6 +1023,10 @@ dr_analyze_indices (struct data_reference *dr, loop_p nest, loop_p loop) build_int_cst (reference_alias_ptr_type (ref), 0)); } + /* Ensure that DR_NUM_DIMENSIONS (dr) != 0. */ + if (access_fns == vNULL) + access_fns.safe_push (integer_zero_node); + DR_BASE_OBJECT (dr) = ref; DR_ACCESS_FNS (dr) = access_fns; } diff --git a/libgomp/testsuite/libgomp.c/pr69110.c b/libgomp/testsuite/libgomp.c/pr69110.c new file mode 100644 index 0000000..0d9e5ca --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr69110.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-options "-ftree-parallelize-loops=2 -O1 -fno-tree-loop-im" } */ + +#define N 1000 + +unsigned int i = 0; + +static void __attribute__((noinline, noclone)) +foo (void) +{ + unsigned int z; + for (z = 0; z < N; ++z) + ++i; +} + +extern void abort (void); + +int +main (void) +{ + foo (); + if (i != N) + abort (); + + return 0; +} -- 1.9.1