public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Julian Brown <julian@codesourcery.com>
To: <gcc-patches@gcc.gnu.org>
Cc: Chung-Lin Tang <cltang@codesourcery.com>,
	Jakub Jelinek <jakub@redhat.com>,
	Thomas Schwinge <thomas@codesourcery.com>, <fortran@gcc.gnu.org>,
	Tobias Burnus <tobias@codesourcery.com>
Subject: [PATCH 4/7] [og10] Revert gimplify.c parts of "Arrow operator handling for C front-end in OpenMP map clauses"
Date: Tue, 11 May 2021 01:56:34 -0700	[thread overview]
Message-ID: <8e978e55e80508930d32e88e563279f4ce491389.1620721888.git.julian@codesourcery.com> (raw)
In-Reply-To: <cover.1620721888.git.julian@codesourcery.com>

With the "rework indirect struct handling" patch later in this series,
some parts of this earlier patch (by Chung-Lin) become unnecessary.
This patch reverts those bits.

An XFAIL has been added for a test that fails for the time being with
this reversion, until the later patch in the series fixes it again.

2021-05-11  Julian Brown  <julian@codesourcery.com>

gcc/
	* gimplify.c (build_struct_group): Remove COMPONENT_REF_P parameter.
	Don't call gimplify_expr on decl in non-reference case.  Remove code to
	add FIRSTPRIVATE_POINTER for *pointer-to-struct expressions.
	(gimplify_scan_omp_clauses): Remove COMPONENT_REF_P handling.

gcc/testsuite/
	* gcc.dg/gomp/target-3.c: XFAIL test.
---
 gcc/gimplify.c                       | 41 ++++------------------------
 gcc/testsuite/gcc.dg/gomp/target-3.c |  2 +-
 2 files changed, 6 insertions(+), 37 deletions(-)

diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 0674d882861..c2072c7188f 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -8686,8 +8686,7 @@ move_concat_nodes_after (tree first_new, tree *last_new_tail, tree *first_ptr,
 static tree
 build_struct_group (struct gimplify_omp_ctx *ctx,
 		    enum omp_region_type region_type, enum tree_code code,
-		    tree decl, tree *pd, bool component_ref_p,
-		    unsigned int *flags, tree c,
+		    tree decl, tree *pd, unsigned int *flags, tree c,
 		    hash_map<tree_operand_hash, tree> *&struct_map_to_clause,
 		    tree *&prev_list_p, tree *&list_p, gimple_seq *pre_p,
 		    bool *cont)
@@ -8737,13 +8736,7 @@ build_struct_group (struct gimplify_omp_ctx *ctx,
       if (base_ref)
 	OMP_CLAUSE_DECL (l) = unshare_expr (base_ref);
       else
-	{
-	  OMP_CLAUSE_DECL (l) = unshare_expr (decl);
-	  if (!DECL_P (OMP_CLAUSE_DECL (l))
-	      && (gimplify_expr (&OMP_CLAUSE_DECL (l), pre_p, NULL,
-				 is_gimple_lvalue, fb_lvalue) == GS_ERROR))
-	    return error_mark_node;
-	}
+	OMP_CLAUSE_DECL (l) = decl;
       OMP_CLAUSE_SIZE (l)
 	= (!attach ? size_int (1)
 	   : (DECL_P (OMP_CLAUSE_DECL (l))
@@ -8785,27 +8778,6 @@ build_struct_group (struct gimplify_omp_ctx *ctx,
 	*flags |= GOVD_SEEN;
       if (has_attachments)
 	*flags |= GOVD_MAP_HAS_ATTACHMENTS;
-
-      /* If this is a *pointer-to-struct expression, make sure a
-	 firstprivate map of the base-pointer exists.  */
-      if (component_ref_p
-	  && ((TREE_CODE (decl) == MEM_REF
-	       && integer_zerop (TREE_OPERAND (decl, 1)))
-	      || INDIRECT_REF_P (decl))
-	  && DECL_P (TREE_OPERAND (decl, 0))
-	  && !splay_tree_lookup (ctx->variables,
-				 ((splay_tree_key) TREE_OPERAND (decl, 0))))
-	{
-	  decl = TREE_OPERAND (decl, 0);
-	  tree c2 = build_omp_clause (OMP_CLAUSE_LOCATION (c), OMP_CLAUSE_MAP);
-	  enum gomp_map_kind mkind = GOMP_MAP_FIRSTPRIVATE_POINTER;
-	  OMP_CLAUSE_SET_MAP_KIND (c2, mkind);
-	  OMP_CLAUSE_DECL (c2) = decl;
-	  OMP_CLAUSE_SIZE (c2) = size_zero_node;
-	  OMP_CLAUSE_CHAIN (c2) = OMP_CLAUSE_CHAIN (c);
-	  OMP_CLAUSE_CHAIN (c) = c2;
-	}
-
       return decl;
     }
   else if (struct_map_to_clause)
@@ -9660,9 +9632,7 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
 		  && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ATTACH_DETACH)
 		OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_ALWAYS_POINTER);
 	      if ((DECL_P (decl)
-		   || (component_ref_p
-		       && (INDIRECT_REF_P (decl)
-			   || TREE_CODE (decl) == MEM_REF)))
+		   || (component_ref_p && INDIRECT_REF_P (decl)))
 		  && OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_TO_PSET
 		  && OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_ATTACH
 		  && OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_DETACH
@@ -9710,9 +9680,8 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
 		  bool cont = false;
 		  tree add_decl
 		    = build_struct_group (ctx, region_type, code, decl, pd,
-					  component_ref_p, &flags, c,
-					  struct_map_to_clause, prev_list_p,
-					  list_p, pre_p, &cont);
+					  &flags, c, struct_map_to_clause,
+					  prev_list_p, list_p, pre_p, &cont);
 		  if (add_decl == error_mark_node)
 		    {
 		      remove = true;
diff --git a/gcc/testsuite/gcc.dg/gomp/target-3.c b/gcc/testsuite/gcc.dg/gomp/target-3.c
index 3e7921270c9..08e42eeb304 100644
--- a/gcc/testsuite/gcc.dg/gomp/target-3.c
+++ b/gcc/testsuite/gcc.dg/gomp/target-3.c
@@ -13,4 +13,4 @@ void foo (struct S *s)
   #pragma omp target enter data map (alloc: s->a, s->b)
 }
 
-/* { dg-final { scan-tree-dump-times "map\\(struct:\\*s \\\[len: 2\\\]\\) map\\(alloc:s->a \\\[len: \[0-9\]+\\\]\\) map\\(alloc:s->b \\\[len: \[0-9\]+\\\]\\)" 2 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "map\\(struct:\\*s \\\[len: 2\\\]\\) map\\(alloc:s->a \\\[len: \[0-9\]+\\\]\\) map\\(alloc:s->b \\\[len: \[0-9\]+\\\]\\)" 2 "gimple" { xfail *-*-* } } } */
-- 
2.29.2


  parent reply	other threads:[~2021-05-11  8:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11  8:56 [PATCH 0/7] [og10] OpenACC/OpenMP: Rework struct component handling Julian Brown
2021-05-11  8:56 ` [PATCH 1/7] [og10] Unify ARRAY_REF/INDIRECT_REF stripping code in extract_base_bit_offset Julian Brown
2021-05-11  8:56 ` [PATCH 2/7] [og10] Refactor struct lowering for OpenMP/OpenACC in gimplify.c Julian Brown
2021-05-11  8:56 ` [PATCH 3/7] [og10] Revert gimplify.c parts of "Fix template case of non-static member access inside member functions" Julian Brown
2021-05-11  8:56 ` Julian Brown [this message]
2021-05-11  8:57 ` [PATCH 5/7] [og10] Rewrite GOMP_MAP_ATTACH_DETACH mappings for OpenMP also Julian Brown
2021-05-11  8:57 ` [PATCH 6/7] [og10] Rework indirect struct handling for OpenACC/OpenMP in gimplify.c Julian Brown
2021-05-11  8:57 ` [PATCH 7/7] [og10] WIP GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION changes Julian Brown
2021-05-17 13:14   ` Chung-Lin Tang
2021-05-17 14:26     ` Julian Brown
2021-05-18 11:13       ` Chung-Lin Tang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8e978e55e80508930d32e88e563279f4ce491389.1620721888.git.julian@codesourcery.com \
    --to=julian@codesourcery.com \
    --cc=cltang@codesourcery.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=thomas@codesourcery.com \
    --cc=tobias@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).