From patchwork Tue Jan 12 12:46:50 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: 566544 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 855AC1402A0 for ; Tue, 12 Jan 2016 23:51:36 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=KuoSjTyP; 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=JidW1PY3a4uRNlHdR witJe8pP7/dAlDh/r8nwUhdkaRHG/fGL0WvxhI/Bo5vRRZA4uG+jgEfs2545LXWz EjMzkbdOiVfupX6i6SItDuRZSZ1fGgDTwagN4TBStN+Oo7FafbrlEKrxRyWgvn8N Ht9rNn+eXAujPmCS26fu1W1PiU= 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=+4PiNgI9jxffArCVVNmao9U cQSk=; b=KuoSjTyPslN70M/uYvT288DnlQ/Tufuz0vFEuW5vrC2fWGeodhV6dR5 SSDvMW3UDox5aN0asbqeiTdDD1MDEzeyF7CNaLjVhJfEpN5yXRvD14drPjBE6yQV Wbf7UzdQHGDN1gNnTfG4sPGp4t9zw19hG6K5jB9MDTr2VCLzaFoI= Received: (qmail 66234 invoked by alias); 12 Jan 2016 12:51:29 -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 66220 invoked by uid 89); 12 Jan 2016 12:51:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL, BAYES_50, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=treedatarefc, UD:tree-data-ref.c, tree-data-ref.c, SUCCESS 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 12:51:27 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33741) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1aIyQ1-0000jX-F3 for gcc-patches@gnu.org; Tue, 12 Jan 2016 07:51:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aIyPv-000743-UQ for gcc-patches@gnu.org; Tue, 12 Jan 2016 07:51:24 -0500 Received: from relay1.mentorg.com ([192.94.38.131]:46449) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIyPv-000714-PF for gcc-patches@gnu.org; Tue, 12 Jan 2016 07:51:19 -0500 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-03.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1aIyPn-0006Oa-M9 from Tom_deVries@mentor.com ; Tue, 12 Jan 2016 04:51:11 -0800 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-03.mgc.mentorg.com (137.202.0.108) with Microsoft SMTP Server id 14.3.224.2; Tue, 12 Jan 2016 12:46:53 +0000 Subject: Re: [PATCH, PR69110] Don't return NULL access_fns in dr_analyze_indices To: Richard Biener References: <5694CF85.1020708@mentor.com> CC: "gcc-patches@gnu.org" , Sebastian Pop From: Tom de Vries Message-ID: <5694F5BA.7030207@mentor.com> Date: Tue, 12 Jan 2016 13:46:50 +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 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. Thanks, - Tom 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 | 3 +++ libgomp/testsuite/libgomp.c/pr69110.c | 26 ++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) 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..6503012 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -1023,6 +1023,9 @@ dr_analyze_indices (struct data_reference *dr, loop_p nest, loop_p loop) build_int_cst (reference_alias_ptr_type (ref), 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; +}