public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Julian Brown <jules@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/omp/gcc-13] Revert "Fix references declared in lexically-enclosing OpenACC data region"
Date: Mon, 19 Jun 2023 22:17:02 +0000 (GMT)	[thread overview]
Message-ID: <20230619221702.A631B3858C66@sourceware.org> (raw)

https://gcc.gnu.org/g:1394fbcfe614958a969fcc6cdc6f3b53c5bcb6da

commit 1394fbcfe614958a969fcc6cdc6f3b53c5bcb6da
Author: Julian Brown <julian@codesourcery.com>
Date:   Wed May 17 15:14:50 2023 +0000

    Revert "Fix references declared in lexically-enclosing OpenACC data region"
    
    This reverts commit c9cd2bac6a5127a01c6f47e5636a926ac39b5e21.
    
    2023-06-16  Julian Brown  <julian@codesourcery.com>
    
    gcc/fortran/
            Revert:
            * trans-openmp.cc (gfc_omp_finish_clause): Guard addition of clauses for
            pointers with DECL_P.
    
    gcc/
            Revert:
            * gimplify.cc (oacc_array_mapping_info): Add REF field.
            (gimplify_scan_omp_clauses): Initialise above field for data blocks
            passed by reference.
            (gomp_oacc_needs_data_present): Handle references.
            (gimplify_adjust_omp_clauses_1): Handle references and optional
            arguments for variables declared in lexically-enclosing OpenACC data
            region.

Diff:
---
 gcc/ChangeLog.omp           | 13 +++++++++++
 gcc/fortran/ChangeLog.omp   |  8 +++++++
 gcc/fortran/trans-openmp.cc |  2 +-
 gcc/gimplify.cc             | 55 ++++++---------------------------------------
 4 files changed, 29 insertions(+), 49 deletions(-)

diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index 2b8752dcef2..36bb919108b 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,16 @@
+2023-06-19  Julian Brown  <julian@codesourcery.com>
+
+	Revert:
+	2019-05-19  Julian Brown  <julian@codesourcery.com>
+
+	* gimplify.cc (oacc_array_mapping_info): Add REF field.
+	(gimplify_scan_omp_clauses): Initialise above field for data blocks
+	passed by reference.
+	(gomp_oacc_needs_data_present): Handle references.
+	(gimplify_adjust_omp_clauses_1): Handle references and optional
+	arguments for variables declared in lexically-enclosing OpenACC data
+	region.
+
 2023-06-19  Julian Brown  <julian@codesourcery.com>
 
 	Revert:
diff --git a/gcc/fortran/ChangeLog.omp b/gcc/fortran/ChangeLog.omp
index 9d8a607af13..0f430b1261d 100644
--- a/gcc/fortran/ChangeLog.omp
+++ b/gcc/fortran/ChangeLog.omp
@@ -1,3 +1,11 @@
+2023-06-19  Julian Brown  <julian@codesourcery.com>
+
+	Revert:
+	2019-05-19  Julian Brown  <julian@codesourcery.com>
+
+	* trans-openmp.cc (gfc_omp_finish_clause): Guard addition of clauses for
+	pointers with DECL_P.
+
 2023-06-19  Julian Brown  <julian@codesourcery.com>
 
 	Revert:
diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc
index e55c8292d05..96e91a3bc50 100644
--- a/gcc/fortran/trans-openmp.cc
+++ b/gcc/fortran/trans-openmp.cc
@@ -1611,7 +1611,7 @@ gfc_omp_finish_clause (tree c, gimple_seq *pre_p, bool openacc)
   tree c2 = NULL_TREE, c3 = NULL_TREE, c4 = NULL_TREE;
   tree present = gfc_omp_check_optional_argument (decl, true);
   tree orig_decl = NULL_TREE;
-  if (DECL_P (decl) && POINTER_TYPE_P (TREE_TYPE (decl)))
+  if (POINTER_TYPE_P (TREE_TYPE (decl)))
     {
       if (!gfc_omp_privatize_by_reference (decl)
 	  && !GFC_DECL_GET_SCALAR_POINTER (decl)
diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index 3729b986801..80f1f3a657f 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -227,7 +227,6 @@ struct oacc_array_mapping_info
   tree mapping;
   tree pset;
   tree pointer;
-  tree ref;
 };
 
 struct gimplify_omp_ctx
@@ -11248,9 +11247,6 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
 		  }
 		if (base_ptr
 		    && OMP_CLAUSE_CODE (base_ptr) == OMP_CLAUSE_MAP
-		    && !(OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
-			 && (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ALLOC
-			     || OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_POINTER))
 		    && OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_TO_PSET
 		    && ((OMP_CLAUSE_MAP_KIND (base_ptr)
 			 == GOMP_MAP_FIRSTPRIVATE_POINTER)
@@ -11269,19 +11265,6 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
 		    ai.mapping = unshare_expr (c);
 		    ai.pset = pset ? unshare_expr (pset) : NULL;
 		    ai.pointer = unshare_expr (base_ptr);
-		    ai.ref = NULL_TREE;
-		    if (TREE_CODE (base_addr) == INDIRECT_REF
-			&& (TREE_CODE (TREE_TYPE (TREE_OPERAND (base_addr, 0)))
-			    == REFERENCE_TYPE))
-		      {
-			base_addr = TREE_OPERAND (base_addr, 0);
-			tree ref_clause = OMP_CLAUSE_CHAIN (base_ptr);
-			gcc_assert ((OMP_CLAUSE_CODE (ref_clause)
-				     == OMP_CLAUSE_MAP)
-				    && (OMP_CLAUSE_MAP_KIND (ref_clause)
-				        == GOMP_MAP_POINTER));
-			ai.ref = unshare_expr (ref_clause);
-		      }
 		    ctx->decl_data_clause->put (base_addr, ai);
 		  }
 		if (TREE_CODE (TREE_TYPE (decl)) != ARRAY_TYPE)
@@ -12464,15 +12447,11 @@ gomp_oacc_needs_data_present (tree decl)
       && gimplify_omp_ctxp->region_type != ORT_ACC_KERNELS)
     return NULL;
 
-  tree type = TREE_TYPE (decl);
-  if (TREE_CODE (type) == REFERENCE_TYPE)
-    type = TREE_TYPE (type);
-
-  if (TREE_CODE (type) != ARRAY_TYPE
-      && TREE_CODE (type) != POINTER_TYPE
-      && TREE_CODE (type) != RECORD_TYPE
-      && (TREE_CODE (type) != POINTER_TYPE
-	  || TREE_CODE (TREE_TYPE (type)) != ARRAY_TYPE))
+  if (TREE_CODE (TREE_TYPE (decl)) != ARRAY_TYPE
+      && TREE_CODE (TREE_TYPE (decl)) != POINTER_TYPE
+      && TREE_CODE (TREE_TYPE (decl)) != RECORD_TYPE
+      && (TREE_CODE (TREE_TYPE (decl)) != POINTER_TYPE
+	  || TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) != ARRAY_TYPE))
     return NULL;
 
   decl = get_base_address (decl);
@@ -12626,12 +12605,6 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data)
     {
       tree mapping = array_info->mapping;
       tree pointer = array_info->pointer;
-      gomp_map_kind presence_kind = GOMP_MAP_FORCE_PRESENT;
-      bool no_alloc = (OMP_CLAUSE_CODE (mapping) == OMP_CLAUSE_MAP
-		       && OMP_CLAUSE_MAP_KIND (mapping) == GOMP_MAP_IF_PRESENT);
-
-      if (no_alloc || omp_check_optional_argument (decl, false))
-        presence_kind = GOMP_MAP_IF_PRESENT;
 
       if (code == OMP_CLAUSE_FIRSTPRIVATE)
 	/* Oops, we have the wrong type of clause.  Rebuild it.  */
@@ -12639,15 +12612,14 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data)
 				   OMP_CLAUSE_MAP);
 
       OMP_CLAUSE_DECL (clause) = unshare_expr (OMP_CLAUSE_DECL (mapping));
-      OMP_CLAUSE_SET_MAP_KIND (clause, presence_kind);
+      OMP_CLAUSE_SET_MAP_KIND (clause, GOMP_MAP_FORCE_PRESENT);
       OMP_CLAUSE_SIZE (clause) = unshare_expr (OMP_CLAUSE_SIZE (mapping));
 
       /* Create a new data clause for the firstprivate pointer.  */
       tree nc = build_omp_clause (OMP_CLAUSE_LOCATION (clause),
 				  OMP_CLAUSE_MAP);
       OMP_CLAUSE_DECL (nc) = unshare_expr (OMP_CLAUSE_DECL (pointer));
-      OMP_CLAUSE_SET_MAP_KIND (nc, no_alloc ? GOMP_MAP_FIRSTPRIVATE_POINTER
-					    : GOMP_MAP_POINTER);
+      OMP_CLAUSE_SET_MAP_KIND (nc, GOMP_MAP_POINTER);
 
       /* For GOMP_MAP_FIRSTPRIVATE_POINTER, this is a bias, not a size.  */
       OMP_CLAUSE_SIZE (nc) = unshare_expr (OMP_CLAUSE_SIZE (pointer));
@@ -12677,19 +12649,6 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data)
 
       OMP_CLAUSE_CHAIN (nc) = OMP_CLAUSE_CHAIN (clause);
       OMP_CLAUSE_CHAIN (clause) = psetc ? psetc : nc;
-
-      if (array_info->ref)
-	{
-	  tree refc = build_omp_clause (OMP_CLAUSE_LOCATION (clause),
-					OMP_CLAUSE_MAP);
-	  OMP_CLAUSE_DECL (refc)
-	    = unshare_expr (OMP_CLAUSE_DECL (array_info->ref));
-	  OMP_CLAUSE_SIZE (refc)
-	    = unshare_expr (OMP_CLAUSE_SIZE (array_info->ref));
-	  OMP_CLAUSE_SET_MAP_KIND (refc, GOMP_MAP_POINTER);
-	  OMP_CLAUSE_CHAIN (refc) = OMP_CLAUSE_CHAIN (nc);
-	  OMP_CLAUSE_CHAIN (nc) = refc;
-	}
     }
   else if (code == OMP_CLAUSE_FIRSTPRIVATE && (flags & GOVD_EXPLICIT) == 0)
     OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (clause) = 1;

                 reply	other threads:[~2023-06-19 22:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230619221702.A631B3858C66@sourceware.org \
    --to=jules@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /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).