diff options
author | Jakub Jelinek <jakub@redhat.com> | 2015-05-19 18:16:15 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2015-05-19 18:16:15 +0200 |
commit | 41b37d5ec1064decf497f1ce4657582f4b4807c8 (patch) | |
tree | f14df6d018a5dd0d32f46dd60a2499f36dc0d833 /gcc/cp | |
parent | 94c8e7abf6d395ba65334e9be49181c3081a5062 (diff) | |
download | gcc-41b37d5ec1064decf497f1ce4657582f4b4807c8.zip gcc-41b37d5ec1064decf497f1ce4657582f4b4807c8.tar.gz gcc-41b37d5ec1064decf497f1ce4657582f4b4807c8.tar.bz2 |
re PR middle-end/66199 (lastprivate/linear clause issues on combined constructs)
PR middle-end/66199
* tree.h (OMP_TEAMS_COMBINED): Define.
* gimplify.c (enum gimplify_omp_var_data): Add
GOVD_LINEAR_LASTPRIVATE_NO_OUTER.
(enum omp_region_type): Add ORT_COMBINED_TEAMS.
(omp_notice_variable): Accept both ORT_TEAMS
and ORT_COMBINED_TEAMS. Don't recurse if
GOVD_LINEAR_LASTPRIVATE_NO_OUTER is set and either
GOVD_LINEAR is set, or GOVD_LASTPRIVATE without
GOVD_FIRSTPRIVATE.
(omp_no_lastprivate): New function.
(gimplify_scan_omp_clauses): For OMP_CLAUSE_LASTPRIVATE
and OMP_CLAUSE_LINEAR, if omp_no_lastprivate, don't
notice_outer and set appropriate bits, otherwise make
sure default(none) combined constructs won't complain.
(gimplify_adjust_omp_clauses): Remove OMP_CLAUSE_LINEAR
outer special casing, for OMP_CLAUSE_LASTPRIVATE if
omp_no_lastprivate either remove the clause or turn it
into OMP_CLAUSE_PRIVATE.
(gimplify_omp_for): Fix up handling of implicit
lastprivate or linear iterators.
(gimplify_omp_workshare): For OMP_TEAMS_COMBINED use
ORT_COMBINED_TEAMS.
* omp-low.c (lower_omp_for_lastprivate): For combined
for simd use fd.loop.n2 from the for rather than simd.
gcc/c/
* c-parser.c (c_parser_omp_for_loop): Don't add
OMP_CLAUSE_SHARED to OMP_PARALLEL_CLAUSES when moving
OMP_CLAUSE_LASTPRIVATE clause to OMP_FOR_CLAUSES.
(c_parser_omp_teams): Set OMP_TEAMS_COMBINED for combined
constructs.
gcc/cp/
* parser.c (cp_parser_omp_for_loop): Don't add
OMP_CLAUSE_SHARED to OMP_PARALLEL_CLAUSES when moving
OMP_CLAUSE_LASTPRIVATE clause to OMP_FOR_CLAUSES.
(cp_parser_omp_teams): Set OMP_TEAMS_COMBINED for combined
constructs.
gcc/fortran/
* trans-openmp.c (gfc_trans_omp_teams): Set OMP_TEAMS_COMBINED for
combined constructs.
(gfc_trans_omp_target): Make sure BIND_EXPR has non-NULL
BIND_EXPR_BLOCK.
libgomp/
* testsuite/libgomp.c/pr66199-1.c: New test.
* testsuite/libgomp.c/pr66199-2.c: New test.
* testsuite/libgomp.c++/pr66199-1.C: New test.
* testsuite/libgomp.c++/pr66199-2.C: New test.
* testsuite/libgomp.fortran/pr66199-1.f90: New test.
* testsuite/libgomp.fortran/pr66199-2.f90: New test.
From-SVN: r223387
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/cp/parser.c | 11 |
2 files changed, 13 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3271a54..9a3fb85 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2015-05-19 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/66199 + * parser.c (cp_parser_omp_for_loop): Don't add + OMP_CLAUSE_SHARED to OMP_PARALLEL_CLAUSES when moving + OMP_CLAUSE_LASTPRIVATE clause to OMP_FOR_CLAUSES. + (cp_parser_omp_teams): Set OMP_TEAMS_COMBINED for combined + constructs. + 2015-05-19 Mikhail Maltsev <maltsevm@gmail.com> * typeck.c (composite_pointer_type): Use std::swap instead of explicit diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 432aa1c..4f429a2 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -30493,11 +30493,9 @@ cp_parser_omp_for_loop (cp_parser *parser, enum tree_code code, tree clauses, else if (OMP_CLAUSE_CODE (*c) == OMP_CLAUSE_LASTPRIVATE && OMP_CLAUSE_DECL (*c) == real_decl) { - /* Add lastprivate (decl) clause to OMP_FOR_CLAUSES, - change it to shared (decl) in OMP_PARALLEL_CLAUSES. */ - tree l = build_omp_clause (loc, OMP_CLAUSE_LASTPRIVATE); - OMP_CLAUSE_DECL (l) = real_decl; - CP_OMP_CLAUSE_INFO (l) = CP_OMP_CLAUSE_INFO (*c); + /* Move lastprivate (decl) clause to OMP_FOR_CLAUSES. */ + tree l = *c; + *c = OMP_CLAUSE_CHAIN (*c); if (code == OMP_SIMD) { OMP_CLAUSE_CHAIN (l) = cclauses[C_OMP_CLAUSE_SPLIT_FOR]; @@ -30508,8 +30506,6 @@ cp_parser_omp_for_loop (cp_parser *parser, enum tree_code code, tree clauses, OMP_CLAUSE_CHAIN (l) = clauses; clauses = l; } - OMP_CLAUSE_SET_CODE (*c, OMP_CLAUSE_SHARED); - CP_OMP_CLAUSE_INFO (*c) = NULL; add_private_clause = false; } else @@ -31343,6 +31339,7 @@ cp_parser_omp_teams (cp_parser *parser, cp_token *pragma_tok, TREE_TYPE (ret) = void_type_node; OMP_TEAMS_CLAUSES (ret) = clauses; OMP_TEAMS_BODY (ret) = body; + OMP_TEAMS_COMBINED (ret) = 1; return add_stmt (ret); } } |