summaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c60
1 files changed, 31 insertions, 29 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 2e8c657acf7..1ca847ac759 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -2204,12 +2204,6 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value)
if (! EXPR_HAS_LOCATION (*expr_p))
SET_EXPR_LOCATION (*expr_p, input_location);
- if (fn_contains_cilk_spawn_p (cfun)
- && lang_hooks.cilkplus.cilk_detect_spawn_and_unwrap (expr_p)
- && !seen_error ())
- return (enum gimplify_status)
- lang_hooks.cilkplus.gimplify_cilk_spawn (expr_p, pre_p, NULL);
-
/* This may be a call to a builtin function.
Builtin function calls may be transformed into different
@@ -4427,12 +4421,6 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
gcc_assert (TREE_CODE (*expr_p) == MODIFY_EXPR
|| TREE_CODE (*expr_p) == INIT_EXPR);
-
- if (fn_contains_cilk_spawn_p (cfun)
- && lang_hooks.cilkplus.cilk_detect_spawn_and_unwrap (expr_p)
- && !seen_error ())
- return (enum gimplify_status)
- lang_hooks.cilkplus.gimplify_cilk_spawn (expr_p, pre_p, post_p);
/* Trying to simplify a clobber using normal logic doesn't work,
so handle it here. */
@@ -5829,7 +5817,7 @@ omp_is_private (struct gimplify_omp_ctx *ctx, tree decl, bool simd)
region's REDUCTION clause. */
static bool
-omp_check_private (struct gimplify_omp_ctx *ctx, tree decl)
+omp_check_private (struct gimplify_omp_ctx *ctx, tree decl, bool copyprivate)
{
splay_tree_node n;
@@ -5838,8 +5826,11 @@ omp_check_private (struct gimplify_omp_ctx *ctx, tree decl)
ctx = ctx->outer_context;
if (ctx == NULL)
return !(is_global_var (decl)
- /* References might be private, but might be shared too. */
- || lang_hooks.decls.omp_privatize_by_reference (decl));
+ /* References might be private, but might be shared too,
+ when checking for copyprivate, assume they might be
+ private, otherwise assume they might be shared. */
+ || (!copyprivate
+ && lang_hooks.decls.omp_privatize_by_reference (decl)));
if ((ctx->region_type & (ORT_TARGET | ORT_TARGET_DATA)) != 0)
continue;
@@ -6049,12 +6040,36 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
remove = true;
break;
}
+ if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_COPYPRIVATE
+ && !remove
+ && !omp_check_private (ctx, decl, true))
+ {
+ remove = true;
+ if (is_global_var (decl))
+ {
+ if (DECL_THREAD_LOCAL_P (decl))
+ remove = false;
+ else if (DECL_HAS_VALUE_EXPR_P (decl))
+ {
+ tree value = get_base_address (DECL_VALUE_EXPR (decl));
+
+ if (value
+ && DECL_P (value)
+ && DECL_THREAD_LOCAL_P (value))
+ remove = false;
+ }
+ }
+ if (remove)
+ error_at (OMP_CLAUSE_LOCATION (c),
+ "copyprivate variable %qE is not threadprivate"
+ " or private in outer context", DECL_NAME (decl));
+ }
do_notice:
if (outer_ctx)
omp_notice_variable (outer_ctx, decl, true);
if (check_non_private
&& region_type == ORT_WORKSHARE
- && omp_check_private (ctx, decl))
+ && omp_check_private (ctx, decl, false))
{
error ("%s variable %qE is private in outer context",
check_non_private, DECL_NAME (decl));
@@ -7383,19 +7398,6 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
}
break;
- case CILK_SPAWN_STMT:
- gcc_assert
- (fn_contains_cilk_spawn_p (cfun)
- && lang_hooks.cilkplus.cilk_detect_spawn_and_unwrap (expr_p));
- if (!seen_error ())
- {
- ret = (enum gimplify_status)
- lang_hooks.cilkplus.gimplify_cilk_spawn (expr_p, pre_p,
- post_p);
- break;
- }
- /* If errors are seen, then just process it as a CALL_EXPR. */
-
case CALL_EXPR:
ret = gimplify_call_expr (expr_p, pre_p, fallback != fb_none);