diff options
author | Jakub Jelinek <jakub@redhat.com> | 2019-06-04 14:49:03 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2019-06-04 14:49:03 +0200 |
commit | 7855700e63045fcd807718625e1c45f561dc7085 (patch) | |
tree | 89b18afd8600dee3f74ec8eee9799a4697964396 /gcc/omp-low.c | |
parent | 0697ecea7cc6f2a0813716fcf8d922f312f59dce (diff) | |
download | gcc-7855700e63045fcd807718625e1c45f561dc7085.zip gcc-7855700e63045fcd807718625e1c45f561dc7085.tar.gz gcc-7855700e63045fcd807718625e1c45f561dc7085.tar.bz2 |
gimplify.c (gimplify_scan_omp_clauses): Don't sorry_at on lastprivate conditional on combined for simd.
* gimplify.c (gimplify_scan_omp_clauses): Don't sorry_at on lastprivate
conditional on combined for simd.
* omp-low.c (struct omp_context): Add combined_into_simd_safelen0
member.
(lower_rec_input_clauses): For gimple_omp_for_combined_into_p max_vf 1
constructs, don't remove lastprivate_conditional_map, but instead set
ctx->combined_into_simd_safelen0 and adjust hash_map, so that it points
to parent construct temporaries.
(lower_lastprivate_clauses): Handle ctx->combined_into_simd_safelen0
like !ctx->lastprivate_conditional_map.
(lower_omp_1) <case GIMPLE_ASSIGN>: If up->combined_into_simd_safelen0,
use up->outer context instead of up.
* omp-expand.c (expand_omp_for_generic): Perform cond_var bump even if
gimple_omp_for_combined_p.
(expand_omp_for_static_nochunk): Likewise.
(expand_omp_for_static_chunk): Add forgotten cond_var bump that was
probably moved over into expand_omp_for_generic rather than being copied
there.
gcc/cp/
* cp-tree.h (CP_OMP_CLAUSE_INFO): Allow for any clauses up to _condvar_
instead of only up to linear.
gcc/testsuite/
* c-c++-common/gomp/lastprivate-conditional-2.c (foo): Don't expect
a sorry_at on any of the clauses.
libgomp/
* testsuite/libgomp.c-c++-common/lastprivate-conditional-7.c: New test.
* testsuite/libgomp.c-c++-common/lastprivate-conditional-8.c: New test.
* testsuite/libgomp.c-c++-common/lastprivate-conditional-9.c: New test.
* testsuite/libgomp.c-c++-common/lastprivate-conditional-10.c: New test.
From-SVN: r271907
Diffstat (limited to 'gcc/omp-low.c')
-rw-r--r-- | gcc/omp-low.c | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c index cfc237c..8fb68a1 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -137,6 +137,10 @@ struct omp_context /* True if this construct can be cancelled. */ bool cancellable; + + /* True if lower_omp_1 should look up lastprivate conditional in parent + context. */ + bool combined_into_simd_safelen0; }; static splay_tree all_contexts; @@ -4816,6 +4820,8 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist, void_node); gimple_seq tseq = NULL; gimplify_and_add (x, &tseq); + if (ctx->outer) + lower_omp (&tseq, ctx->outer); gimple_seq_add_seq (&llist[1], tseq); } if (y) @@ -5278,11 +5284,31 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist, sctx.is_simt = false; if (ctx->lastprivate_conditional_map) { - /* When not vectorized, treat lastprivate(conditional:) like - normal lastprivate, as there will be just one simd lane - writing the privatized variable. */ - delete ctx->lastprivate_conditional_map; - ctx->lastprivate_conditional_map = NULL; + if (gimple_omp_for_combined_into_p (ctx->stmt)) + { + /* Signal to lower_omp_1 that it should use parent context. */ + ctx->combined_into_simd_safelen0 = true; + for (c = clauses; c ; c = OMP_CLAUSE_CHAIN (c)) + if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE + && OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (c)) + { + tree o = lookup_decl (OMP_CLAUSE_DECL (c), ctx); + tree *v + = ctx->lastprivate_conditional_map->get (o); + tree po = lookup_decl (OMP_CLAUSE_DECL (c), ctx->outer); + tree *pv + = ctx->outer->lastprivate_conditional_map->get (po); + *v = *pv; + } + } + else + { + /* When not vectorized, treat lastprivate(conditional:) like + normal lastprivate, as there will be just one simd lane + writing the privatized variable. */ + delete ctx->lastprivate_conditional_map; + ctx->lastprivate_conditional_map = NULL; + } } } @@ -5652,7 +5678,8 @@ lower_lastprivate_clauses (tree clauses, tree predicate, gimple_seq *body_p, if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE && OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (c) - && ctx->lastprivate_conditional_map) + && ctx->lastprivate_conditional_map + && !ctx->combined_into_simd_safelen0) { gcc_assert (body_p); if (simduid) @@ -10812,6 +10839,8 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context *ctx) if (tree *v = up->lastprivate_conditional_map->get (lhs)) { tree clauses; + if (up->combined_into_simd_safelen0) + up = up->outer; if (gimple_code (up->stmt) == GIMPLE_OMP_FOR) clauses = gimple_omp_for_clauses (up->stmt); else |