aboutsummaryrefslogtreecommitdiff
path: root/gcc/omp-low.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/omp-low.c
parenta37a22da2d9304489f6e4b91d0a357c25e0a0a79 (diff)
downloadgcc-1a80d6b87d81c3f336ab199a901cf80ae349c335.zip
gcc-1a80d6b87d81c3f336ab199a901cf80ae349c335.tar.gz
gcc-1a80d6b87d81c3f336ab199a901cf80ae349c335.tar.bz2
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/omp-low.c')
-rw-r--r--gcc/omp-low.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index a923e37..0b44588 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -1852,14 +1852,18 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
the receiver side will use them directly. */
if (is_global_var (maybe_lookup_decl_in_outer_ctx (decl, ctx)))
break;
- by_ref = use_pointer_for_field (decl, ctx);
if (OMP_CLAUSE_SHARED_FIRSTPRIVATE (c))
- break;
- if (! TREE_READONLY (decl)
+ {
+ use_pointer_for_field (decl, ctx);
+ break;
+ }
+ by_ref = use_pointer_for_field (decl, NULL);
+ if ((! TREE_READONLY (decl) && !OMP_CLAUSE_SHARED_READONLY (c))
|| TREE_ADDRESSABLE (decl)
|| by_ref
|| is_reference (decl))
{
+ by_ref = use_pointer_for_field (decl, ctx);
install_var_field (decl, by_ref, 3, ctx);
install_var_local (decl, ctx);
break;