[gomp4.1] Add new versions of GOMP_target{,_data,_update} and GOMP_target_enter_exit_data
Ilya Verbin
iverbin@gmail.com
Tue Jun 23 14:55:00 GMT 2015
On Tue, Jun 23, 2015 at 13:51:39 +0200, Jakub Jelinek wrote:
> > + /* Set dd on target to 0 for the further check. */
> > + #pragma omp target map(always to: dd)
> > + { dd; }
>
> This reminds me that:
> if (ctx->region_type == ORT_TARGET && !(n->value & GOVD_SEEN))
> remove = true;
> in gimplify.c is not what we want, if it is has GOMP_MAP_KIND_ALWAYS,
> then we shouldn't remove it even when it is not mentioned inside of the
> region's body, because it then has side-effects.
OK for gomp-4_1-branch?
gcc/
* gimplify.c (gimplify_adjust_omp_clauses): Don't remove map clause if
it has map-type-modifier always.
libgomp/
* testsuite/libgomp.c/target-11.c (main): Remove dd from target region.
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 9b2347a..74fe60b 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -6870,7 +6870,8 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, tree *list_p)
if (!DECL_P (decl))
break;
n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl);
- if (ctx->region_type == ORT_TARGET && !(n->value & GOVD_SEEN))
+ if (ctx->region_type == ORT_TARGET && !(n->value & GOVD_SEEN)
+ && !(OMP_CLAUSE_MAP_KIND (c) & GOMP_MAP_FLAG_ALWAYS))
remove = true;
else if (DECL_SIZE (decl)
&& TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST
diff --git a/libgomp/testsuite/libgomp.c/target-11.c b/libgomp/testsuite/libgomp.c/target-11.c
index 4562d88..0fd183b 100644
--- a/libgomp/testsuite/libgomp.c/target-11.c
+++ b/libgomp/testsuite/libgomp.c/target-11.c
@@ -13,7 +13,7 @@ int main ()
/* Set dd on target to 0 for the further check. */
#pragma omp target map(always to: dd)
- { dd; }
+ ;
dd = 1;
#pragma omp target map(tofrom: aa) map(always to: bb) \
-- Ilya
More information about the Gcc-patches
mailing list