aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Brown <julian@codesourcery.com>2019-05-20 17:27:38 -0700
committerThomas Schwinge <thomas@codesourcery.com>2020-03-03 12:17:59 +0100
commit51615ae84f5a6a6bdc1489aa6c14d4ad12f0d623 (patch)
treebeb4745ce95268a0e3db1ee2f078d64acbada8dc
parent95c9c226ec289498f7d5263d211ab2766b54981b (diff)
downloadgcc-51615ae84f5a6a6bdc1489aa6c14d4ad12f0d623.zip
gcc-51615ae84f5a6a6bdc1489aa6c14d4ad12f0d623.tar.gz
gcc-51615ae84f5a6a6bdc1489aa6c14d4ad12f0d623.tar.bz2
Fix lexically-nested data mappings for no_alloc or optional arguments
gcc/ * gimplify.c (gimplify_adjust_omp_clauses_1): Support implied no_alloc and optional arguments based on mappings in enclosing data regions. (cherry picked from openacc-gcc-9-branch commit 34ca2518b914173caec7f3287b29cd1b012e0d8d)
-rw-r--r--gcc/ChangeLog.omp5
-rw-r--r--gcc/gimplify.c12
2 files changed, 13 insertions, 4 deletions
diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index eac7b7a..5fa5035 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,8 @@
+2019-05-20 Julian Brown <julian@codesourcery.com>
+
+ * gimplify.c (gimplify_adjust_omp_clauses_1): Support implied no_alloc
+ and optional arguments based on mappings in enclosing data regions.
+
2019-05-19 Julian Brown <julian@codesourcery.com>
* gimplify.c (oacc_array_mapping_info): Add REF field.
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 7e46ef4..56d707d 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -9853,9 +9853,12 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data)
{
tree mapping = array_info->mapping;
tree pointer = array_info->pointer;
- const gomp_map_kind presence_kind
- = omp_is_optional_argument (decl) ? GOMP_MAP_NO_ALLOC
- : GOMP_MAP_FORCE_PRESENT;
+ gomp_map_kind presence_kind = GOMP_MAP_FORCE_PRESENT;
+ bool no_alloc = (OMP_CLAUSE_CODE (mapping) == OMP_CLAUSE_MAP
+ && OMP_CLAUSE_MAP_KIND (mapping) == GOMP_MAP_NO_ALLOC);
+
+ if (no_alloc || omp_is_optional_argument (decl))
+ presence_kind = GOMP_MAP_NO_ALLOC;
if (code == OMP_CLAUSE_FIRSTPRIVATE)
/* Oops, we have the wrong type of clause. Rebuild it. */
@@ -9870,7 +9873,8 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data)
tree nc = build_omp_clause (OMP_CLAUSE_LOCATION (clause),
OMP_CLAUSE_MAP);
OMP_CLAUSE_DECL (nc) = unshare_expr (OMP_CLAUSE_DECL (pointer));
- OMP_CLAUSE_SET_MAP_KIND (nc, GOMP_MAP_POINTER);
+ OMP_CLAUSE_SET_MAP_KIND (nc, no_alloc ? GOMP_MAP_FIRSTPRIVATE_POINTER
+ : GOMP_MAP_POINTER);
/* For GOMP_MAP_FIRSTPRIVATE_POINTER, this is a bias, not a size. */
OMP_CLAUSE_SIZE (nc) = unshare_expr (OMP_CLAUSE_SIZE (pointer));