diff mbox series

Follow-up Patch – Re: [Patch][OpenMP] Fix 'omp exit data' for Fortran arrays (PR 94635)

Message ID a16685eb-6c40-69f8-ed08-defb9a9161c8@codesourcery.com
State New
Headers show
Series Follow-up Patch – Re: [Patch][OpenMP] Fix 'omp exit data' for Fortran arrays (PR 94635) | expand

Commit Message

Tobias Burnus April 23, 2020, 1:43 p.m. UTC
On 4/20/20 11:33 PM, Thomas Schwinge wrote:
> Really 'GOMP_MAP_DELETE', or should that rather be 'GOMP_MAP_RELEASE'?

Depends on the previous item, i.e. 'delete:' vs. 'release:/from:/…'

Rather obvious – OK?

Tobias

-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter

Comments

Tobias Burnus May 5, 2020, 4:36 p.m. UTC | #1
OK for mainline and (once it opens) the GCC 10 branch?

This is a simple & quick to review patch.

Tobias

On 4/23/20 3:43 PM, Tobias Burnus wrote:

> On 4/20/20 11:33 PM, Thomas Schwinge wrote:
>> Really 'GOMP_MAP_DELETE', or should that rather be 'GOMP_MAP_RELEASE'?
>
> Depends on the previous item, i.e. 'delete:' vs. 'release:/from:/…'
>
> Rather obvious – OK?
>
> Tobias
>
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter
Jakub Jelinek May 12, 2020, 10:48 a.m. UTC | #2
On Thu, Apr 23, 2020 at 03:43:47PM +0200, Tobias Burnus wrote:
> On 4/20/20 11:33 PM, Thomas Schwinge wrote:
> > Really 'GOMP_MAP_DELETE', or should that rather be 'GOMP_MAP_RELEASE'?
> 
> Depends on the previous item, i.e. 'delete:' vs. 'release:/from:/…'
> 
> Rather obvious – OK?
> 
> Tobias
> 
> -----------------
> Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
> Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter

> [OpenMP] Fix 'omp exit data' for Fortran arrays (PR 94635)
> 
> 	PR middle-end/94635
> 	* gimplify.c (gimplify_scan_omp_clauses): For MAP_TO_PSET with
> 	OMP_TARGET_EXIT_DATA, use 'release:' unless the associated
> 	item is 'delete:'.
> 
> 	PR middle-end/94635
> 	* gfortran.dg/gomp/target-exit-data.f90: New.

Ok, thanks.

	Jakub
diff mbox series

Patch

[OpenMP] Fix 'omp exit data' for Fortran arrays (PR 94635)

	PR middle-end/94635
	* gimplify.c (gimplify_scan_omp_clauses): For MAP_TO_PSET with
	OMP_TARGET_EXIT_DATA, use 'release:' unless the associated
	item is 'delete:'.

	PR middle-end/94635
	* gfortran.dg/gomp/target-exit-data.f90: New.

 gcc/gimplify.c                                      |  4 +++-
 gcc/testsuite/gfortran.dg/gomp/target-exit-data.f90 | 20 ++++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 2f2c51b2d89..0bac9900210 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -8789,7 +8789,9 @@  gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
 	     to be delete; hence, we turn the MAP_TO_PSET into a MAP_DELETE.  */
 	  if (code == OMP_TARGET_EXIT_DATA
 	      && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_TO_PSET)
-	    OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_DELETE);
+	    OMP_CLAUSE_SET_MAP_KIND (c, OMP_CLAUSE_MAP_KIND (*prev_list_p)
+					== GOMP_MAP_DELETE
+					? GOMP_MAP_DELETE : GOMP_MAP_RELEASE);
 	  else if ((code == OMP_TARGET_EXIT_DATA || code == OMP_TARGET_UPDATE)
 		   && (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_POINTER
 		       || OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_TO_PSET))
diff --git a/gcc/testsuite/gfortran.dg/gomp/target-exit-data.f90 b/gcc/testsuite/gfortran.dg/gomp/target-exit-data.f90
new file mode 100644
index 00000000000..ed57d0072d7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/target-exit-data.f90
@@ -0,0 +1,20 @@ 
+! { dg-do compile }
+! { dg-additional-options "-fdump-tree-omplower" }
+!
+! PR middle-end/94635
+
+integer, allocatable :: one(:), two(:), three(:)
+
+!$omp target enter data map(alloc:one)
+!$omp target enter data map(alloc:two)
+!$omp target enter data map(to:three)
+
+! ...
+!$omp target exit data map(delete:one)
+!$omp target exit data map(release:two)
+!$omp target exit data map(from:three)
+end
+
+! { dg-final { scan-tree-dump "omp target exit data map\\(delete:.*\\) map\\(delete:one \\\[len: .*\\\]\\)" "omplower" } }
+! { dg-final { scan-tree-dump "omp target exit data map\\(release:.*\\) map\\(release:two \\\[len: .*\\\]\\)" "omplower" } }
+! { dg-final { scan-tree-dump "omp target exit data map\\(from:.*\\) map\\(release:three \\\[len: .*\\\]\\)" "omplower" } }