aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-06-05 09:37:40 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2019-06-05 09:37:40 +0200
commit28b3a77ca055b31aa20c6d263be42c49be32756b (patch)
treed8b2e5d9a854fa1c38354bd53152dc401bc87199 /gcc
parent9ea2bfca6a3fd80f14d24557f71efaafae3846a9 (diff)
downloadgcc-28b3a77ca055b31aa20c6d263be42c49be32756b.zip
gcc-28b3a77ca055b31aa20c6d263be42c49be32756b.tar.gz
gcc-28b3a77ca055b31aa20c6d263be42c49be32756b.tar.bz2
omp-low.c (lower_rec_input_clauses): For lastprivate conditional references...
* omp-low.c (lower_rec_input_clauses): For lastprivate conditional references, lookup in in hash map MEM_REF operand instead of the MEM_REF itself. (lower_omp_1): When looking for lastprivate conditional assignments, handle MEM_REFs with REFERENCE_TYPE operands. * testsuite/libgomp.c++/lastprivate-conditional-1.C: New test. * testsuite/libgomp.c++/lastprivate-conditional-2.C: New test. From-SVN: r271948
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/omp-low.c15
2 files changed, 19 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0d47c35..cc706e2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2019-06-05 Jakub Jelinek <jakub@redhat.com>
+ * omp-low.c (lower_rec_input_clauses): For lastprivate conditional
+ references, lookup in in hash map MEM_REF operand instead of the
+ MEM_REF itself.
+ (lower_omp_1): When looking for lastprivate conditional assignments,
+ handle MEM_REFs with REFERENCE_TYPE operands.
+
* omp-low.c (lower_rec_input_clauses): Force max_vf if is_simd and
on privatization clauses OMP_CLAUSE_DECL is privatized by reference
and references a VLA. Handle references to non-VLAs if is_simd
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 8ec8f09..a7f35ff 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -4818,8 +4818,14 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist,
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE
&& OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (c))
{
- tree v
- = *ctx->lastprivate_conditional_map->get (new_var);
+ tree v = new_var;
+ if (!DECL_P (v))
+ {
+ gcc_assert (TREE_CODE (v) == MEM_REF);
+ v = TREE_OPERAND (v, 0);
+ gcc_assert (DECL_P (v));
+ }
+ v = *ctx->lastprivate_conditional_map->get (v);
tree t = create_tmp_var (TREE_TYPE (v));
tree z = build_zero_cst (TREE_TYPE (v));
tree orig_v
@@ -10926,6 +10932,11 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context *ctx)
else if (!up->lastprivate_conditional_map)
break;
tree lhs = get_base_address (gimple_assign_lhs (stmt));
+ if (TREE_CODE (lhs) == MEM_REF
+ && DECL_P (TREE_OPERAND (lhs, 0))
+ && TREE_CODE (TREE_TYPE (TREE_OPERAND (lhs,
+ 0))) == REFERENCE_TYPE)
+ lhs = TREE_OPERAND (lhs, 0);
if (DECL_P (lhs))
if (tree *v = up->lastprivate_conditional_map->get (lhs))
{