public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Julian Brown <julian@codesourcery.com>
To: <gcc-patches@gcc.gnu.org>
Cc: <fortran@gcc.gnu.org>, Jakub Jelinek <jakub@redhat.com>,
	Tobias Burnus <tobias@codesourcery.com>,
	Thomas Schwinge <thomas@codesourcery.com>,
	Chung-Lin Tang <cltang@codesourcery.com>
Subject: [PATCH 3/5] Rewrite GOMP_MAP_ATTACH_DETACH mappings for OpenMP also
Date: Fri, 14 May 2021 14:26:25 -0700	[thread overview]
Message-ID: <c5192493228cf9b1af0aa13a61806a53cfa0ff1d.1621026372.git.julian@codesourcery.com> (raw)
In-Reply-To: <cover.1621026371.git.julian@codesourcery.com>

It never makes sense for a GOMP_MAP_ATTACH_DETACH mapping to survive
beyond gimplify.c, and with OpenMP making use of that mapping type too
now alongside OpenACC, there are cases where it was making it through
to omp-low.c.  This patch rewrites such mappings to GOMP_MAP_ATTACH or
GOMP_MAP_DETACH unconditionally for both OpenACC and OpenMP, in cases
where it hasn't otherwise been handled already in the preceding code.

OK for trunk?

Thanks,

Julian

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

gcc/
	* gimplify.c (gimplify_scan_omp_clauses): Remove OpenACC-only
	condition for changing GOMP_MAP_ATTACH_DETACH to GOMP_MAP_ATTACH or
	GOMP_MAP_DETACH.  Use detach for OMP_TARGET_EXIT_DATA also.
---
 gcc/gimplify.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 599063bcd5f..69ab637367c 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -9648,16 +9648,11 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
 		  if (cont)
 		    continue;
 		}
-	      else if ((code == OACC_ENTER_DATA
-			|| code == OACC_EXIT_DATA
-			|| code == OACC_DATA
-			|| code == OACC_PARALLEL
-			|| code == OACC_KERNELS
-			|| code == OACC_SERIAL)
-		       && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ATTACH_DETACH)
+	      else if (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ATTACH_DETACH)
 		{
-		  gomp_map_kind k = (code == OACC_EXIT_DATA
-				     ? GOMP_MAP_DETACH : GOMP_MAP_ATTACH);
+		  gomp_map_kind k
+		    = ((code == OACC_EXIT_DATA || code == OMP_TARGET_EXIT_DATA)
+		       ? GOMP_MAP_DETACH : GOMP_MAP_ATTACH);
 		  OMP_CLAUSE_SET_MAP_KIND (c, k);
 		}
 
-- 
2.29.2


  parent reply	other threads:[~2021-05-14 21:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-14 21:26 [PATCH 0/5] OpenACC/OpenMP: Rework struct component handling Julian Brown
2021-05-14 21:26 ` [PATCH 1/5] Unify ARRAY_REF/INDIRECT_REF stripping code in extract_base_bit_offset Julian Brown
2021-05-14 21:26 ` [PATCH 2/5] Refactor struct lowering for OpenMP/OpenACC in gimplify.c Julian Brown
2021-05-14 21:26 ` Julian Brown [this message]
2021-05-14 21:26 ` [PATCH 4/5] Rework indirect struct handling for OpenACC/OpenMP " Julian Brown
2021-05-17 12:12   ` Bernd Edlinger
2021-05-17 14:10     ` Julian Brown
2021-05-14 21:27 ` [PATCH 5/5] Mapping of components of references to pointers to structs for OpenMP/OpenACC Julian Brown
2021-05-17 13:07   ` Chung-Lin Tang
2021-05-17 14:12     ` Julian Brown

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=c5192493228cf9b1af0aa13a61806a53cfa0ff1d.1621026372.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).