From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 105812 invoked by alias); 30 Nov 2015 17:57:01 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 105798 invoked by uid 89); 30 Nov 2015 17:57:00 -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,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 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; Mon, 30 Nov 2015 17:56:59 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44477) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1a3Sh6-0007Tk-PT for gcc-patches@gnu.org; Mon, 30 Nov 2015 12:56:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a3Sh2-0005La-BB for gcc-patches@gnu.org; Mon, 30 Nov 2015 12:56:56 -0500 Received: from relay1.mentorg.com ([192.94.38.131]:43561) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3Sh2-0005LU-52 for gcc-patches@gnu.org; Mon, 30 Nov 2015 12:56:52 -0500 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1a3Sh0-00057c-5m from Tom_deVries@mentor.com ; Mon, 30 Nov 2015 09:56:50 -0800 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Mon, 30 Nov 2015 17:56:48 +0000 Subject: Re: [PATCH, PR46032] Handle BUILT_IN_GOMP_PARALLEL in ipa-pta To: Jakub Jelinek References: <565C0F47.5020604@mentor.com> <565C3CEC.9040209@mentor.com> <565C7B09.6000206@mentor.com> <20151130164855.GH5675@tucnak.redhat.com> CC: Richard Biener , "gcc-patches@gnu.org" From: Tom de Vries Message-ID: <565C8DA4.4030401@mentor.com> Date: Mon, 30 Nov 2015 18:00:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20151130164855.GH5675@tucnak.redhat.com> Content-Type: multipart/mixed; boundary="------------050806010503020000040809" X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-Received-From: 192.94.38.131 X-SW-Source: 2015-11/txt/msg03513.txt.bz2 --------------050806010503020000040809 Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Content-length: 866 On 30/11/15 17:48, Jakub Jelinek wrote: > On Mon, Nov 30, 2015 at 05:36:25PM +0100, Tom de Vries wrote: >> +int >> +main (void) >> +{ >> + unsigned results[nEvents]; >> + unsigned pData[nEvents]; >> + unsigned coeff = 2; >> + >> + init (&results[0], &pData[0]); >> + >> +#pragma omp parallel for >> + for (int idx = 0; idx < (int)nEvents; idx++) >> + results[idx] = coeff * pData[idx]; > > Could you please add another testcase, where you have say pData > and some other pointer that init sets to alias with pData, and verify > that such loop (would need to be say normal loop inside #pragma omp single > or master) is not vectorized? I've: - added a simpler (not vectorizer-based) version of the testcase as pr46032-2.c, and - copied pr46032-2.c to pr46032-3.c and modified it such that two pointers are aliasing Committed to trunk. Thanks, - Tom --------------050806010503020000040809 Content-Type: text/x-patch; name="0001-Add-gcc.dg-pr46032-2-3-.c-test-cases.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="0001-Add-gcc.dg-pr46032-2-3-.c-test-cases.patch" Content-length: 2093 Add gcc.dg/pr46032-{2,3}.c test-cases 2015-11-30 Tom de Vries * gcc.dg/pr46032-2.c: New test. * gcc.dg/pr46032-3.c: New test. --- gcc/testsuite/gcc.dg/pr46032-2.c | 29 +++++++++++++++++++++++++++++ gcc/testsuite/gcc.dg/pr46032-3.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/gcc/testsuite/gcc.dg/pr46032-2.c b/gcc/testsuite/gcc.dg/pr46032-2.c new file mode 100644 index 0000000..e110880 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr46032-2.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fopenmp -std=c99 -fipa-pta -fdump-tree-optimized" } */ + +#define N 2 + +int +foo (void) +{ + int a[N], b[N], c[N]; + int *ap = &a[0]; + int *bp = &b[0]; + int *cp = &c[0]; + +#pragma omp parallel for + for (unsigned int idx = 0; idx < N; idx++) + { + ap[idx] = 1; + bp[idx] = 2; + cp[idx] = ap[idx]; + } + + return *cp; +} + +/* { dg-final { scan-tree-dump-times "\\] = 1;" 2 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "\\] = 2;" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "\\] = _\[0-9\]*;" 0 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "\\] = " 3 "optimized" } } */ + diff --git a/gcc/testsuite/gcc.dg/pr46032-3.c b/gcc/testsuite/gcc.dg/pr46032-3.c new file mode 100644 index 0000000..a4af7ec --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr46032-3.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fopenmp -std=c99 -fipa-pta -fdump-tree-optimized" } */ + +#define N 2 + +int +foo (void) +{ + int a[N], c[N]; + int *ap = &a[0]; + int *bp = &a[0]; + int *cp = &c[0]; + +#pragma omp parallel for + for (unsigned int idx = 0; idx < N; idx++) + { + ap[idx] = 1; + bp[idx] = 2; + cp[idx] = ap[idx]; + } + + return *cp; +} + +/* { dg-final { scan-tree-dump-times "\\] = 1;" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "\\] = 2;" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "\\] = _\[0-9\]*;" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "\\] = " 3 "optimized" } } */ --------------050806010503020000040809--