aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-08-05 10:40:10 +0200
committerJakub Jelinek <jakub@redhat.com>2020-08-05 10:40:10 +0200
commit916c7a201a9a1dc94f2c056a773826a26d1daca9 (patch)
tree3af4b82309abf7bb69f3987109b08d07b1d657f3 /gcc
parent325714b4968050c927fe72f4a4ba860da2bf4ee2 (diff)
downloadgcc-916c7a201a9a1dc94f2c056a773826a26d1daca9.zip
gcc-916c7a201a9a1dc94f2c056a773826a26d1daca9.tar.gz
gcc-916c7a201a9a1dc94f2c056a773826a26d1daca9.tar.bz2
openmp: Handle reduction clauses on host teams construct [PR96459]
As the new testcase shows, we weren't actually performing reductions on host teams construct. And fixing that revealed a flaw in the for-14.c testcase. The problem is that the tests perform also initialization and checking around the calls to the functions with the OpenMP constructs. In that testcase, all the tests have been spawned from a teams construct but only the tested loops were distribute, which means the initialization and checking has been performed redundantly and racily in each team. Fixed by performing the initialization and checking outside of host teams and only do the calls to functions with the tested constructs inside of host teams. 2020-08-05 Jakub Jelinek <jakub@redhat.com> PR middle-end/96459 * omp-low.c (lower_omp_taskreg): Call lower_reduction_clauses even in for host teams. * testsuite/libgomp.c/teams-3.c: New test. * testsuite/libgomp.c-c++-common/for-2.h (OMPTEAMS): Define to nothing if not defined yet. (N(test)): Use it before all N(f*) calls. * testsuite/libgomp.c-c++-common/for-14.c (DO_PRAGMA, OMPTEAMS): Define. (main): Don't call all test_* functions from within #pragma omp teams reduction(|:err), call them directly.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/omp-low.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 52c2cae..53efe5f 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -11236,7 +11236,7 @@ lower_omp_taskreg (gimple_stmt_iterator *gsi_p, omp_context *ctx)
gimple_seq par_rlist = NULL;
lower_rec_input_clauses (clauses, &par_ilist, &par_olist, ctx, NULL);
lower_omp (&par_body, ctx);
- if (gimple_code (stmt) == GIMPLE_OMP_PARALLEL)
+ if (gimple_code (stmt) != GIMPLE_OMP_TASK)
lower_reduction_clauses (clauses, &par_rlist, NULL, ctx);
/* Declare all the variables created by mapping and the variables