aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family/c-omp.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-07-03 06:56:25 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2019-07-03 06:56:25 +0200
commit83eb9522087c0f1f152873da00ade34e5f3e67e5 (patch)
treedf2542661fab9ef8615c69f2f2a5c03502eec739 /gcc/c-family/c-omp.c
parent1a39b3d3e22ba34b750e277fae9634d0af015cae (diff)
downloadgcc-83eb9522087c0f1f152873da00ade34e5f3e67e5.zip
gcc-83eb9522087c0f1f152873da00ade34e5f3e67e5.tar.gz
gcc-83eb9522087c0f1f152873da00ade34e5f3e67e5.tar.bz2
gimplify.c (gimplify_scan_omp_clauses): For inscan reductions on worksharing loop propagate it as shared clause to...
* gimplify.c (gimplify_scan_omp_clauses): For inscan reductions on worksharing loop propagate it as shared clause to containing combined parallel. * c-omp.c (c_omp_split_clauses): Put OMP_CLAUSE_REDUCTION_INSCAN clauses on OMP_FOR rather than OMP_PARALLEL when OMP_FOR is combined with OMP_PARALLEL. * c-c++-common/gomp/scan-5.c: New test. From-SVN: r272957
Diffstat (limited to 'gcc/c-family/c-omp.c')
-rw-r--r--gcc/c-family/c-omp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/c-family/c-omp.c b/gcc/c-family/c-omp.c
index 97206a1..583305e 100644
--- a/gcc/c-family/c-omp.c
+++ b/gcc/c-family/c-omp.c
@@ -1634,7 +1634,8 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
break;
/* Reduction is allowed on simd, for, parallel, sections, taskloop
and teams. Duplicate it on all of them, but omit on for or
- sections if parallel is present. If taskloop is combined with
+ sections if parallel is present (unless inscan, in that case
+ omit on parallel). If taskloop is combined with
parallel, omit it on parallel. */
case OMP_CLAUSE_REDUCTION:
if (OMP_CLAUSE_REDUCTION_TASK (clauses))
@@ -1708,7 +1709,8 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
s = C_OMP_CLAUSE_SPLIT_PARALLEL;
}
else if ((mask & (OMP_CLAUSE_MASK_1
- << PRAGMA_OMP_CLAUSE_NUM_THREADS)) != 0)
+ << PRAGMA_OMP_CLAUSE_NUM_THREADS)) != 0
+ && !OMP_CLAUSE_REDUCTION_INSCAN (clauses))
s = C_OMP_CLAUSE_SPLIT_PARALLEL;
else
s = C_OMP_CLAUSE_SPLIT_FOR;