summaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2014-05-02 17:43:40 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2014-05-02 17:43:40 +0000
commit9d172013409a3edff7bb43ed6162bf4d0ee72d58 (patch)
treeaf453d4b9541da0c90d1c0689ff569fa7c986574 /gcc/gimplify.c
parent1fcecb123d804ed63241f44f3d12b8ba0864f0c6 (diff)
downloadgcc-9d172013409a3edff7bb43ed6162bf4d0ee72d58.tar.gz
* gimplify.c (gimplify_adjust_omp_clauses_1): Handle
GOVD_FIRSTPRIVATE | GOVD_LASTPRIVATE. (gimplify_adjust_omp_clauses): Simd region is never directly nested in combined parallel. Instead, for linear with copyin/copyout, if in combined for simd loop, make decl firstprivate/lastprivate on OMP_FOR. * omp-low.c (expand_omp_for_generic, expand_omp_for_static_nochunk, expand_omp_for_static_chunk): When setting endvar, also set fd->loop.v to the same value. libgomp/ * testsuite/libgomp.c/simd-10.c: New test. * testsuite/libgomp.c/simd-11.c: New test. * testsuite/libgomp.c/simd-12.c: New test. * testsuite/libgomp.c/simd-13.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@210009 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 008a2528644..37c3778624f 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -6273,9 +6273,17 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data)
OMP_CLAUSE_CHAIN (clause) = nc;
}
}
+ if (code == OMP_CLAUSE_FIRSTPRIVATE && (flags & GOVD_LASTPRIVATE) != 0)
+ {
+ tree nc = build_omp_clause (input_location, OMP_CLAUSE_LASTPRIVATE);
+ OMP_CLAUSE_DECL (nc) = decl;
+ OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE (nc) = 1;
+ OMP_CLAUSE_CHAIN (nc) = *list_p;
+ OMP_CLAUSE_CHAIN (clause) = nc;
+ lang_hooks.decls.omp_finish_clause (nc);
+ }
*list_p = clause;
lang_hooks.decls.omp_finish_clause (clause);
-
return 0;
}
@@ -6314,18 +6322,17 @@ gimplify_adjust_omp_clauses (tree *list_p)
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LINEAR
&& ctx->outer_context
&& !(OMP_CLAUSE_LINEAR_NO_COPYIN (c)
- && OMP_CLAUSE_LINEAR_NO_COPYOUT (c))
- && !is_global_var (decl))
+ && OMP_CLAUSE_LINEAR_NO_COPYOUT (c)))
{
- if (ctx->outer_context->region_type == ORT_COMBINED_PARALLEL)
+ if (ctx->outer_context->combined_loop
+ && !OMP_CLAUSE_LINEAR_NO_COPYIN (c))
{
n = splay_tree_lookup (ctx->outer_context->variables,
(splay_tree_key) decl);
if (n == NULL
|| (n->value & GOVD_DATA_SHARE_CLASS) == 0)
{
- int flags = OMP_CLAUSE_LINEAR_NO_COPYIN (c)
- ? GOVD_LASTPRIVATE : GOVD_SHARED;
+ int flags = GOVD_FIRSTPRIVATE | GOVD_LASTPRIVATE;
if (n == NULL)
omp_add_variable (ctx->outer_context, decl,
flags | GOVD_SEEN);
@@ -6333,7 +6340,7 @@ gimplify_adjust_omp_clauses (tree *list_p)
n->value |= flags | GOVD_SEEN;
}
}
- else
+ else if (!is_global_var (decl))
omp_notice_variable (ctx->outer_context, decl, true);
}
}