diff options
author | Jakub Jelinek <jakub@redhat.com> | 2019-07-03 06:51:45 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2019-07-03 06:51:45 +0200 |
commit | 1a39b3d3e22ba34b750e277fae9634d0af015cae (patch) | |
tree | 8053a414e8bfb250cf183875bac03ed33de612fc /gcc | |
parent | 61a02d1e97aa9b2cb3c4e3e5c823d3a8a4c5834c (diff) | |
download | gcc-1a39b3d3e22ba34b750e277fae9634d0af015cae.zip gcc-1a39b3d3e22ba34b750e277fae9634d0af015cae.tar.gz gcc-1a39b3d3e22ba34b750e277fae9634d0af015cae.tar.bz2 |
omp-expand.c (expand_omp_for_static_nochunk, [...]): For nowait worksharing loop with conditional lastprivate clause(s)...
* omp-expand.c (expand_omp_for_static_nochunk,
expand_omp_for_static_chunk): For nowait worksharing loop with
conditional lastprivate clause(s), emit GOMP_loop_end_nowait call
at the end.
* c-c++-common/gomp/lastprivate-conditional-5.c: New test.
From-SVN: r272956
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/omp-expand.c | 12 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/gomp/lastprivate-conditional-5.c | 33 |
4 files changed, 56 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c7fed52..58937b0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-07-03 Jakub Jelinek <jakub@redhat.com> + + * omp-expand.c (expand_omp_for_static_nochunk, + expand_omp_for_static_chunk): For nowait worksharing loop with + conditional lastprivate clause(s), emit GOMP_loop_end_nowait call + at the end. + 2019-07-02 Joern Rennecke <joern.rennecke@riscy-ip.com> PR testsuite/91065 diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c index 69344f4..6902425 100644 --- a/gcc/omp-expand.c +++ b/gcc/omp-expand.c @@ -4039,6 +4039,12 @@ expand_omp_for_static_nochunk (struct omp_region *region, else gsi_insert_after (&gsi, omp_build_barrier (t), GSI_SAME_STMT); } + else if (fd->have_pointer_condtemp) + { + tree fn = builtin_decl_explicit (BUILT_IN_GOMP_LOOP_END_NOWAIT); + gcall *g = gimple_build_call (fn, 0); + gsi_insert_after (&gsi, g, GSI_SAME_STMT); + } gsi_remove (&gsi, true); /* Connect all the blocks. */ @@ -4696,6 +4702,12 @@ expand_omp_for_static_chunk (struct omp_region *region, else gsi_insert_after (&gsi, omp_build_barrier (t), GSI_SAME_STMT); } + else if (fd->have_pointer_condtemp) + { + tree fn = builtin_decl_explicit (BUILT_IN_GOMP_LOOP_END_NOWAIT); + gcall *g = gimple_build_call (fn, 0); + gsi_insert_after (&gsi, g, GSI_SAME_STMT); + } gsi_remove (&gsi, true); /* Connect the new blocks. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9bb683f..5abccee 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-07-03 Jakub Jelinek <jakub@redhat.com> + + * c-c++-common/gomp/lastprivate-conditional-5.c: New test. + 2019-07-02 Jeff Law <law@redhat.com> PR tree-optimization/90883 diff --git a/gcc/testsuite/c-c++-common/gomp/lastprivate-conditional-5.c b/gcc/testsuite/c-c++-common/gomp/lastprivate-conditional-5.c new file mode 100644 index 0000000..51f6b30 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/lastprivate-conditional-5.c @@ -0,0 +1,33 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fopenmp -fdump-tree-ompexp" } */ +/* { dg-final { scan-tree-dump-times "GOMP_loop_start " 3 "ompexp" } } */ +/* { dg-final { scan-tree-dump-times "GOMP_loop_end_nowait " 3 "ompexp" } } */ + +int r; + +void +foo (int *a) +{ + #pragma omp for nowait lastprivate(conditional: r) + for (int i = 0; i < 64; ++i) + if (a[i]) + r = a[i]; +} + +void +bar (int *a) +{ + #pragma omp for nowait lastprivate(conditional: r) schedule (static, 4) + for (int i = 0; i < 64; ++i) + if (a[i]) + r = a[i]; +} + +void +baz (int *a) +{ + #pragma omp for nowait lastprivate(conditional: r) schedule (runtime) + for (int i = 0; i < 64; ++i) + if (a[i]) + r = a[i]; +} |