diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2020-10-22 11:04:22 +0200 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2020-11-03 09:35:33 +0100 |
commit | 64dc14b1a764bd3059170431c9b43c6192dbd48f (patch) | |
tree | 2aa43ca4750250953ed7a6a7ea370854c173409a /gcc/omp-low.c | |
parent | fedf3e94efe774b8c0539d344130a7b25f50a881 (diff) | |
download | gcc-64dc14b1a764bd3059170431c9b43c6192dbd48f.zip gcc-64dc14b1a764bd3059170431c9b43c6192dbd48f.tar.gz gcc-64dc14b1a764bd3059170431c9b43c6192dbd48f.tar.bz2 |
[OpenACC] Enable inconsistent nested 'reduction' clauses checking for OpenACC 'kernels'
gcc/
* omp-low.c (scan_omp_for) <OpenACC>: Move earlier inconsistent
nested 'reduction' clauses checking.
gcc/testsuite/
* c-c++-common/goacc/nested-reductions-1-kernels.c: Extend.
* c-c++-common/goacc/nested-reductions-2-kernels.c: Likewise.
* gfortran.dg/goacc/nested-reductions-1-kernels.f90: Likewise.
* gfortran.dg/goacc/nested-reductions-2-kernels.f90: Likewise.
Diffstat (limited to 'gcc/omp-low.c')
-rw-r--r-- | gcc/omp-low.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c index de5142f..2f1a544 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -2454,23 +2454,7 @@ scan_omp_for (gomp_for *stmt, omp_context *outer_ctx) } if (tgt && is_oacc_kernels (tgt)) - { - /* Strip out reductions, as they are not handled yet. */ - tree *prev_ptr = &clauses; - - while (tree probe = *prev_ptr) - { - tree *next_ptr = &OMP_CLAUSE_CHAIN (probe); - - if (OMP_CLAUSE_CODE (probe) == OMP_CLAUSE_REDUCTION) - *prev_ptr = *next_ptr; - else - prev_ptr = next_ptr; - } - - gimple_omp_for_set_clauses (stmt, clauses); - check_oacc_kernel_gwv (stmt, ctx); - } + check_oacc_kernel_gwv (stmt, ctx); /* Collect all variables named in reductions on this loop. Ensure that, if this loop has a reduction on some variable v, and there is @@ -2553,6 +2537,24 @@ scan_omp_for (gomp_for *stmt, omp_context *outer_ctx) ctx->outer_reduction_clauses = chainon (unshare_expr (ctx->local_reduction_clauses), ctx->outer_reduction_clauses); + + if (tgt && is_oacc_kernels (tgt)) + { + /* Strip out reductions, as they are not handled yet. */ + tree *prev_ptr = &clauses; + + while (tree probe = *prev_ptr) + { + tree *next_ptr = &OMP_CLAUSE_CHAIN (probe); + + if (OMP_CLAUSE_CODE (probe) == OMP_CLAUSE_REDUCTION) + *prev_ptr = *next_ptr; + else + prev_ptr = next_ptr; + } + + gimple_omp_for_set_clauses (stmt, clauses); + } } scan_sharing_clauses (clauses, ctx); |