summaryrefslogtreecommitdiff
path: root/gcc/tree-nested.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2015-11-26 11:18:50 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2015-11-26 11:18:50 +0100
commit1a80d6b87d81c3f336ab199a901cf80ae349c335 (patch)
tree85be78539b8853a0e9fa3ba945ad098e66357002 /gcc/tree-nested.c
parenta37a22da2d9304489f6e4b91d0a357c25e0a0a79 (diff)
re PR tree-optimization/68128 (A huge regression in Parboil v2.5 OpenMP CUTCP test (2.5 times lower performance))
PR tree-optimization/68128 * tree.h (OMP_CLAUSE_SHARED_READONLY): Define. * gimplify.c: Include gimple-walk.h. (enum gimplify_omp_var_data): Add GOVD_WRITTEN. (omp_notice_variable): Set flags to n->value if n already exists in target region, but we need to jump to do_outer. (omp_shared_to_firstprivate_optimizable_decl_p, omp_mark_stores, omp_find_stores_op, omp_find_stores_stmt): New functions. (gimplify_adjust_omp_clauses_1): Set OMP_CLAUSE_SHARED_READONLY on OMP_CLAUSE_SHARED if it is a scalar non-addressable that is not modified in the body. Call omp_mark_stores for outer contexts on OMP_CLAUSE_SHARED clauses if they could be written in the body or on OMP_CLAUSE_LASTPRIVATE. (gimplify_adjust_omp_clauses): Add body argument, call omp_find_stores_{stmt,op} on the body through walk_gimple_seq. Set OMP_CLAUSE_SHARED_READONLY on OMP_CLAUSE_SHARED if it is a scalar non-addressable that is not modified in the body. Call omp_mark_stores for outer contexts on OMP_CLAUSE_SHARED clauses if they could be written in the body or on OMP_CLAUSE_LASTPRIVATE or on OMP_CLAUSE_LINEAR without OMP_CLAUSE_LINEAR_NO_COPYOUT or on OMP_CLAUSE_REDUCTION. (gimplify_oacc_cache, gimplify_omp_parallel, gimplify_omp_task, gimplify_omp_for, gimplify_omp_workshare, gimplify_omp_target_update, gimplify_expr): Adjust gimplify_adjust_omp_clauses callers. * tree-nested.c (convert_nonlocal_omp_clauses, convert_local_omp_clauses): Clear OMP_CLAUSE_SHARED_READONLY on non-local vars or local vars referenced from nested routines. * omp-low.c (scan_sharing_clauses): For OMP_CLAUSE_SHARED_READONLY attempt to optimize it into OMP_CLAUSE_FIRSTPRIVATE. Even for TREE_READONLY, don't call use_pointer_for_field with non-NULL second argument until we are sure we are keeping OMP_CLAUSE_SHARED. * gcc.dg/gomp/pr68128-1.c: New test. * gcc.dg/gomp/pr68128-2.c: New test. From-SVN: r230932
Diffstat (limited to 'gcc/tree-nested.c')
-rw-r--r--gcc/tree-nested.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index 1f6311c295c..6bc5016ff66 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -1081,6 +1081,8 @@ convert_nonlocal_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
break;
if (decl_function_context (decl) != info->context)
{
+ if (OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_SHARED)
+ OMP_CLAUSE_SHARED_READONLY (clause) = 0;
bitmap_set_bit (new_suppress, DECL_UID (decl));
OMP_CLAUSE_DECL (clause) = get_nonlocal_debug_decl (info, decl);
if (OMP_CLAUSE_CODE (clause) != OMP_CLAUSE_PRIVATE)
@@ -1732,6 +1734,8 @@ convert_local_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
tree field = lookup_field_for_decl (info, decl, NO_INSERT);
if (field)
{
+ if (OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_SHARED)
+ OMP_CLAUSE_SHARED_READONLY (clause) = 0;
bitmap_set_bit (new_suppress, DECL_UID (decl));
OMP_CLAUSE_DECL (clause)
= get_local_debug_decl (info, decl, field);