@@ -1084,7 +1084,7 @@ gfc_omp_finish_clause (tree c, gimple_seq *pre_p)
return;
tree orig_decl = decl;
c4 = build_omp_clause (OMP_CLAUSE_LOCATION (c), OMP_CLAUSE_MAP);
- OMP_CLAUSE_SET_MAP_KIND (c4, GOMP_MAP_FIRSTPRIVATE_POINTER);
+ OMP_CLAUSE_SET_MAP_KIND (c4, GOMP_MAP_POINTER);
OMP_CLAUSE_DECL (c4) = decl;
OMP_CLAUSE_SIZE (c4) = size_int (0);
decl = build_fold_indirect_ref (decl);
@@ -1100,10 +1100,7 @@ gfc_omp_finish_clause (tree c, gimple_seq *pre_p)
OMP_CLAUSE_SIZE (c3) = size_int (0);
decl = build_fold_indirect_ref (decl);
OMP_CLAUSE_DECL (c) = decl;
- OMP_CLAUSE_SET_MAP_KIND (c4, GOMP_MAP_POINTER);
}
- if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (decl)))
- OMP_CLAUSE_SET_MAP_KIND (c4, GOMP_MAP_POINTER);
}
if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (decl)))
{
@@ -2168,11 +2165,15 @@ gfc_trans_omp_clauses_1 (stmtblock_t *block, gfc_omp_clauses *clauses,
(TREE_TYPE (TREE_TYPE (field)))))
{
tree orig_decl = decl;
- enum gomp_map_kind gmk = GOMP_MAP_FIRSTPRIVATE_POINTER;
- if (GFC_DECL_GET_SCALAR_ALLOCATABLE (decl)
- && (n->sym->attr.oacc_declare_create)
- && clauses->update_allocatable)
- gmk = ptr_map_kind;
+ enum gomp_map_kind gmk = GOMP_MAP_POINTER;
+ if (GFC_DECL_GET_SCALAR_ALLOCATABLE (field)
+ && n->sym->attr.oacc_declare_create)
+ {
+ if (clauses->update_allocatable)
+ gmk = GOMP_MAP_ALWAYS_POINTER;
+ else
+ gmk = GOMP_MAP_FIRSTPRIVATE_POINTER;
+ }
node4 = build_omp_clause (input_location,
OMP_CLAUSE_MAP);
OMP_CLAUSE_SET_MAP_KIND (node4, gmk);
@@ -2189,10 +2190,7 @@ gfc_trans_omp_clauses_1 (stmtblock_t *block, gfc_omp_clauses *clauses,
OMP_CLAUSE_DECL (node3) = decl;
OMP_CLAUSE_SIZE (node3) = size_int (0);
decl = build_fold_indirect_ref (decl);
- OMP_CLAUSE_SET_MAP_KIND (node4, GOMP_MAP_POINTER);
}
- if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (decl)))
- OMP_CLAUSE_SET_MAP_KIND (node4, GOMP_MAP_POINTER);
}
if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (decl))
&& n->u.map_op != OMP_MAP_ATTACH
@@ -7634,37 +7634,6 @@ find_decl_expr (tree *tp, int *walk_subtrees, void *data)
return NULL_TREE;
}
-static void
-demote_firstprivate_pointer (tree decl, gimplify_omp_ctx *ctx)
-{
- if (!lang_GNU_Fortran ())
- return;
-
- while (ctx)
- {
- if (ctx->region_type == ORT_ACC_PARALLEL
- || ctx->region_type == ORT_ACC_KERNELS)
- break;
- ctx = ctx->outer_context;
- }
-
- if (ctx == NULL)
- return;
-
- tree clauses = ctx->clauses;
-
- for (tree c = clauses; c; c = OMP_CLAUSE_CHAIN (c))
- {
- if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
- && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_FIRSTPRIVATE_POINTER
- && OMP_CLAUSE_DECL (c) == decl)
- {
- OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_POINTER);
- return;
- }
- }
-}
-
/* Insert a GOMP_MAP_ALLOC or GOMP_MAP_RELEASE node following a
GOMP_MAP_STRUCT mapping. C is an always_pointer mapping. STRUCT_NODE is
the struct node to insert the new mapping after (when the struct node is
@@ -7843,7 +7812,7 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
outer_ctx = ctx->outer_context;
if (code == OMP_TARGET)
{
- if (!lang_GNU_Fortran () || (region_type & ORT_ACC))
+ if (!lang_GNU_Fortran ())
ctx->target_map_pointers_as_0len_arrays = true;
ctx->target_map_scalars_firstprivate = true;
}
@@ -7971,7 +7940,6 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
if (!(region_type & ORT_ACC))
check_non_private = "reduction";
decl = OMP_CLAUSE_DECL (c);
- demote_firstprivate_pointer (decl, ctx->outer_context);
if (TREE_CODE (decl) == MEM_REF)
{
tree type = TREE_TYPE (decl);
@@ -9491,16 +9459,11 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, gimple_seq body, tree *list_p,
&& kind != GOMP_MAP_FORCE_PRESENT
&& kind != GOMP_MAP_POINTER)
{
- if (lang_hooks.decls.omp_privatize_by_reference (decl))
- OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_POINTER);
- else
- {
- warning_at (OMP_CLAUSE_LOCATION (c), 0,
- "incompatible data clause with reduction "
- "on %qE; promoting to present_or_copy",
- DECL_NAME (t));
- OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_TOFROM);
- }
+ warning_at (OMP_CLAUSE_LOCATION (c), 0,
+ "incompatible data clause with reduction "
+ "on %qE; promoting to present_or_copy",
+ DECL_NAME (t));
+ OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_TOFROM);
}
}
}
@@ -9112,8 +9112,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
}
else
is_ref = omp_is_reference (var);
- if (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_FIRSTPRIVATE_REFERENCE
- || (lang_GNU_Fortran () && TREE_CODE (var) == PARM_DECL))
+ if (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_FIRSTPRIVATE_REFERENCE)
is_ref = false;
bool ref_to_array = false;
if (is_ref)
@@ -17,6 +17,4 @@ end program main
! Only the omp_data_i related loads should be annotated with cliques.
! { dg-final { scan-tree-dump-times "clique 1 base 1" 2 "ealias" } }
-! The following FAILs since/needs to be updated for the "Partially enable
-! GOMP_MAP_FIRSTPRIVATE_POINTER in gfortran" changes.
-! { dg-final { scan-tree-dump-times "(?n)clique 1 base 0" 3 "ealias" { xfail *-*-* } } }
+! { dg-final { scan-tree-dump-times "(?n)clique 1 base 0" 3 "ealias" } }
@@ -3,11 +3,9 @@
! present.
! { dg-do run }
-! TODO, for "-Os" see <https://gcc.gnu.org/PR80995>, and for the others, this
-! regressed with the "Partially enable GOMP_MAP_FIRSTPRIVATE_POINTER in
-! gfortran" changes.
+! TODO, <https://gcc.gnu.org/PR80995>.
! warning: OpenACC kernels construct will be executed sequentially; will by default avoid offloading to prevent data copy penalty
-! { dg-xfail-if "TODO" { openacc_nvidia_accel_selected } { "-Os" "-O2" "-O3" } { "" } }
+! { dg-xfail-if "TODO" { openacc_nvidia_accel_selected } { "-Os" } { "" } }
program main
implicit none