summaryrefslogtreecommitdiff
path: root/gcc/omp-expand.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-07-04 23:40:56 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2019-07-04 23:40:56 +0200
commit2f03073ff24bbb005d52db7e2b7a5ea32bb01140 (patch)
tree861f13c464eff0a038edfad8ace1666e05fc8213 /gcc/omp-expand.c
parent61afc8f8f0406f00e3020e862bb07c3b48ff26ca (diff)
omp-expand.c (expand_omp_for_static_nochunk): Don't emit GOMP_loop_start at the start of second worksharing loop in a scan.
* omp-expand.c (expand_omp_for_static_nochunk): Don't emit GOMP_loop_start at the start of second worksharing loop in a scan. For nowait, don't emit GOMP_loop_end_nowait at the end of first worksharing loop in a scan even if there are conditional lastprivates, and do emit GOMP_loop_end_nowait at the end of second worksharing loop. * testsuite/libgomp.c/scan-9.c: New test. * testsuite/libgomp.c/scan-10.c: New test. From-SVN: r273095
Diffstat (limited to 'gcc/omp-expand.c')
-rw-r--r--gcc/omp-expand.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c
index 9236b3665e4..1de445b6911 100644
--- a/gcc/omp-expand.c
+++ b/gcc/omp-expand.c
@@ -3744,7 +3744,9 @@ expand_omp_for_static_nochunk (struct omp_region *region,
cond_var = OMP_CLAUSE_DECL (c);
}
if (fd->have_reductemp
- || fd->have_pointer_condtemp
+ /* For scan, we don't want to reinitialize condtemp before the
+ second loop. */
+ || (fd->have_pointer_condtemp && !fd->have_scantemp)
|| fd->have_nonctrl_scantemp)
{
tree t1 = build_int_cst (long_integer_type_node, 0);
@@ -4235,7 +4237,8 @@ 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)
+ else if ((fd->have_pointer_condtemp || fd->have_scantemp)
+ && !fd->have_nonctrl_scantemp)
{
tree fn = builtin_decl_explicit (BUILT_IN_GOMP_LOOP_END_NOWAIT);
gcall *g = gimple_build_call (fn, 0);