public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom de Vries <Tom_deVries@mentor.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Richard Biener <rguenther@suse.de>,
	"gcc-patches@gnu.org"	<gcc-patches@gnu.org>
Subject: Re: [PATCH, PR46032] Handle BUILT_IN_GOMP_PARALLEL in ipa-pta
Date: Mon, 30 Nov 2015 18:00:00 -0000	[thread overview]
Message-ID: <565C8DA4.4030401@mentor.com> (raw)
In-Reply-To: <20151130164855.GH5675@tucnak.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 866 bytes --]

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


[-- Attachment #2: 0001-Add-gcc.dg-pr46032-2-3-.c-test-cases.patch --]
[-- Type: text/x-patch, Size: 2093 bytes --]

Add gcc.dg/pr46032-{2,3}.c test-cases

2015-11-30  Tom de Vries  <tom@codesourcery.com>

	* 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" } } */

  reply	other threads:[~2015-11-30 17:57 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-30  9:00 Tom de Vries
2015-11-30  9:36 ` Richard Biener
2015-11-30 12:20   ` Tom de Vries
2015-11-30 13:32     ` Richard Biener
2015-11-30 13:35       ` Jakub Jelinek
2015-12-03 11:49         ` Tom de Vries
2015-11-30 16:44       ` Tom de Vries
2015-11-30 16:52         ` Jakub Jelinek
2015-11-30 18:00           ` Tom de Vries [this message]
2015-12-01 12:27             ` Christophe Lyon
2015-12-01 12:30               ` Jakub Jelinek
2015-12-01 14:49                 ` Tom de Vries
2015-12-01 14:27         ` [PATCH] Handle BUILT_IN_GOACC_PARALLEL " Tom de Vries
2015-12-01 14:38           ` Richard Biener
2015-12-01 14:44           ` Jakub Jelinek
2015-12-01 23:48             ` Tom de Vries
2015-12-02  9:31               ` Jakub Jelinek
2015-12-02 17:58           ` Thomas Schwinge
2015-12-02 23:32             ` Tom de Vries
2015-12-03  0:10               ` Tom de Vries
2015-12-03  0:27                 ` Tom de Vries
2015-12-03  8:59                   ` Richard Biener
2015-12-03 11:09                     ` Tom de Vries
2015-12-03 11:13                       ` Richard Biener
2015-12-03 11:13                       ` Jakub Jelinek
2015-12-10 13:15                       ` Tom de Vries
2015-12-16 16:02                         ` Tom de Vries
2016-01-05 14:56                           ` [PING][PATCH] Mark symbols in offload tables with force_output in read_offload_tables Tom de Vries
2016-01-25 13:27                             ` Ilya Verbin
2016-01-26 12:22                               ` Tom de Vries
2016-01-26 13:02                                 ` Ilya Verbin
2016-02-08 13:20                                   ` Tom de Vries
2016-02-08 15:02                                     ` Ilya Verbin
2016-02-15  7:38                                     ` [PING][PATCH] Don't mark offload symbols with force_output in ltrans Tom de Vries
2016-02-15  9:07                                       ` Richard Biener
2016-01-26 14:13                                 ` [PING][PATCH] Mark symbols in offload tables with force_output in read_offload_tables Richard Biener
2016-01-08  8:17                           ` [PATCH] Handle BUILT_IN_GOACC_PARALLEL in ipa-pta Richard Biener
2016-01-14  9:31                             ` Thomas Schwinge
2016-01-14  9:32                               ` Richard Biener
2015-12-09 10:01     ` [PATCH, PR68716] Fix GOMP/GOACC_parallel handling in find_func_clobbers Tom de Vries
2015-12-09 10:04       ` Jakub Jelinek
2015-12-09 10:09         ` Richard Biener
2015-12-09 10:11         ` Tom de Vries
2015-12-10  9:01       ` [committed, obvious] Remove invalid assert in find_func_aliases_for_builtin_call Tom de Vries

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=565C8DA4.4030401@mentor.com \
    --to=tom_devries@mentor.com \
    --cc=gcc-patches@gnu.org \
    --cc=jakub@redhat.com \
    --cc=rguenther@suse.de \
    /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).