aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2021-11-22 17:29:09 +0100
committerThomas Schwinge <thomas@codesourcery.com>2021-11-24 11:59:03 +0100
commitfdd34569e7a9fc2b6c638a7ef62b965ed7e832ce (patch)
treeba9e33b7a48e3d8bfc05dbfa7ef0d21ef0655f32 /gcc/gimplify.c
parentc2e681059bcd7f76f13029988f133858dc82c205 (diff)
downloadgcc-fdd34569e7a9fc2b6c638a7ef62b965ed7e832ce.zip
gcc-fdd34569e7a9fc2b6c638a7ef62b965ed7e832ce.tar.gz
gcc-fdd34569e7a9fc2b6c638a7ef62b965ed7e832ce.tar.bz2
Restore previous OpenACC implicit data clauses ordering [PR103244]
Follow-up for recent commit b7e20480630e3eeb9eed8b3941da3b3f0c22c969 "openmp: Relax handling of implicit map vs. existing device mappings". As discussed, we likely also for OpenACC ought to use 'OMP_CLAUSE_MAP_RUNTIME_IMPLICIT_P' and do the appropriate implicit clauses ordering -- but that's for a separate step. gcc/ PR middle-end/103244 * gimplify.c (gimplify_adjust_omp_clauses): Restore previous OpenACC behavior. gcc/testsuite/ PR middle-end/103244 * c-c++-common/goacc/combined-reduction.c: Revert/expect previous OpenACC behavior. * c-c++-common/goacc/firstprivate-mappings-1.c: Likewise. * c-c++-common/goacc/mdc-1.c: Likewise. * g++.dg/goacc/firstprivate-mappings-1.C: Likewise.
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 816cdaf..8624f82 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -11501,15 +11501,21 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, gimple_seq body, tree *list_p,
list_p = &OMP_CLAUSE_CHAIN (c);
}
- /* Add in any implicit data sharing. Implicit clauses are added at the start
- of the clause list, but after any non-map clauses. */
+ /* Add in any implicit data sharing. */
struct gimplify_adjust_omp_clauses_data data;
- tree *implicit_add_list_p = orig_list_p;
- while (*implicit_add_list_p
- && OMP_CLAUSE_CODE (*implicit_add_list_p) != OMP_CLAUSE_MAP)
- implicit_add_list_p = &OMP_CLAUSE_CHAIN (*implicit_add_list_p);
-
- data.list_p = implicit_add_list_p;
+ if ((gimplify_omp_ctxp->region_type & ORT_ACC) == 0)
+ {
+ /* OpenMP. Implicit clauses are added at the start of the clause list,
+ but after any non-map clauses. */
+ tree *implicit_add_list_p = orig_list_p;
+ while (*implicit_add_list_p
+ && OMP_CLAUSE_CODE (*implicit_add_list_p) != OMP_CLAUSE_MAP)
+ implicit_add_list_p = &OMP_CLAUSE_CHAIN (*implicit_add_list_p);
+ data.list_p = implicit_add_list_p;
+ }
+ else
+ /* OpenACC. */
+ data.list_p = list_p;
data.pre_p = pre_p;
splay_tree_foreach (ctx->variables, gimplify_adjust_omp_clauses_1, &data);