summaryrefslogtreecommitdiff
path: root/gcc/omp-low.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2006-05-02 10:44:55 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2006-05-02 10:44:55 +0000
commitdf2c34fcbb12409aa976ade656525b85f2ca1c60 (patch)
treee7fe929b16a97446edb70447a1000494b145b0dd /gcc/omp-low.c
parent5056ba1a33d3f4891671b26c02048d5f7fbeca9f (diff)
downloadgcc-df2c34fcbb12409aa976ade656525b85f2ca1c60.tar.gz
PR middle-end/27337
* gimplify.c (gimplify_scan_omp_clauses): Handle INDIRECT_REF around RESULT_DECL for result passed by reference. (gimplify_expr): Call omp_notice_variable when RESULT_DECL is seen. * omp-low.c (use_pointer_for_field): Don't look at DECL_HAS_VALUE_EXPR_P for RESULT_DECLs. (scan_omp_1): Call remap_decl on RESULT_DECLs. (lower_rec_input_clauses): Don't allocate VLA memory for the second time or var for passing by reference for OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE clauses. Allow creation of TREE_ADDRESSABLE variables when passing by reference. * omp-low.c (dump_omp_region): Fix output formatting. cp/ * cp-gimplify.c (cxx_omp_privatize_by_reference): New function. * cp-tree.h (cxx_omp_privatize_by_reference): New prototype. * cp-objcp-common.h (LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Define. testsuite/ * g++.dg/gomp/pr27337-1.C: New test. * g++.dg/gomp/pr27337-2.C: New test. libgomp/ * testsuite/libgomp.c++/pr27337.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@113456 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/omp-low.c')
-rw-r--r--gcc/omp-low.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 62b715e37ad..f344e6933fb 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -491,7 +491,7 @@ use_pointer_for_field (tree decl, bool shared_p)
without analyzing the expression whether or not its location
is accessible to anyone else. In the case of nested parallel
regions it certainly may be. */
- if (DECL_HAS_VALUE_EXPR_P (decl))
+ if (TREE_CODE (decl) != RESULT_DECL && DECL_HAS_VALUE_EXPR_P (decl))
return true;
/* Do not use copy-in/copy-out for variables that have their
@@ -724,7 +724,7 @@ dump_omp_region (FILE *file, struct omp_region *region, int indent)
}
if (region->exit)
- fprintf (file, "%*sbb: %d: OMP_RETURN\n", indent, "",
+ fprintf (file, "%*sbb %d: OMP_RETURN\n", indent, "",
region->exit->index);
else
fprintf (file, "%*s[no exit marker]\n", indent, "");
@@ -1286,6 +1286,7 @@ scan_omp_1 (tree *tp, int *walk_subtrees, void *data)
case VAR_DECL:
case PARM_DECL:
case LABEL_DECL:
+ case RESULT_DECL:
if (ctx)
*tp = remap_decl (t, &ctx->cb);
break;
@@ -1518,10 +1519,14 @@ lower_rec_input_clauses (tree clauses, tree *ilist, tree *dlist,
break;
case OMP_CLAUSE_SHARED:
case OMP_CLAUSE_FIRSTPRIVATE:
- case OMP_CLAUSE_LASTPRIVATE:
case OMP_CLAUSE_COPYIN:
case OMP_CLAUSE_REDUCTION:
break;
+ case OMP_CLAUSE_LASTPRIVATE:
+ if (pass != 0
+ && OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE (c))
+ continue;
+ break;
default:
continue;
}
@@ -1564,7 +1569,8 @@ lower_rec_input_clauses (tree clauses, tree *ilist, tree *dlist,
code that expects a pointer to something that expects
a direct variable. Note that this doesn't apply to
C++, since reference types are disallowed in data
- sharing clauses there. */
+ sharing clauses there, except for NRV optimized
+ return values. */
if (pass == 0)
continue;
@@ -1575,7 +1581,9 @@ lower_rec_input_clauses (tree clauses, tree *ilist, tree *dlist,
if (DECL_NAME (var))
name = IDENTIFIER_POINTER (DECL_NAME (new_var));
- x = create_tmp_var (TREE_TYPE (TREE_TYPE (new_var)), name);
+ x = create_tmp_var_raw (TREE_TYPE (TREE_TYPE (new_var)),
+ name);
+ gimple_add_tmp_var (x);
x = build_fold_addr_expr_with_type (x, TREE_TYPE (new_var));
}
else