[gcc(refs/users/marxin/heads/marxin-gcc-benchmark-branch)] openmp: Notice reduction decl in outer contexts after adding it to shared [PR93515]

Martin Liska marxin@gcc.gnu.org
Mon Mar 30 10:49:21 GMT 2020


https://gcc.gnu.org/g:cf785618ecc90e3f063b99572de48cb91aa5ab5d

commit cf785618ecc90e3f063b99572de48cb91aa5ab5d
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Feb 6 09:15:13 2020 +0100

    openmp: Notice reduction decl in outer contexts after adding it to shared [PR93515]
    
    If we call omp_add_variable, following omp_notice_variable will already find it
    on that construct and not go through outer constructs, the following patch fixes that.
    Note, this still doesn't follow OpenMP 5.0 semantics on target combined with other
    constructs with reduction/lastprivate/linear clauses, will handle that for GCC11.
    
    2020-02-06  Jakub Jelinek  <jakub@redhat.com>
    
            PR libgomp/93515
            * gimplify.c (gimplify_scan_omp_clauses) <do_notice>: If adding
            shared clause, call omp_notice_variable on outer context if any.

Diff:
---
 gcc/ChangeLog  |  6 ++++++
 gcc/gimplify.c | 10 +++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c31b861fff8..df6bbe608db 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2020-02-06  Jakub Jelinek  <jakub@redhat.com>
+
+	PR libgomp/93515
+	* gimplify.c (gimplify_scan_omp_clauses) <do_notice>: If adding
+	shared clause, call omp_notice_variable on outer context if any.
+
 2020-02-05  Jason Merrill  <jason@redhat.com>
 
 	PR c++/92003
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index e50be5706c7..aafef786637 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -9464,9 +9464,13 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
 				  == POINTER_TYPE))))
 		    omp_firstprivatize_variable (outer_ctx, decl);
 		  else
-		    omp_add_variable (outer_ctx, decl,
-				      GOVD_SEEN | GOVD_SHARED);
-		  omp_notice_variable (outer_ctx, decl, true);
+		    {
+		      omp_add_variable (outer_ctx, decl,
+					GOVD_SEEN | GOVD_SHARED);
+		      if (outer_ctx->outer_context)
+			omp_notice_variable (outer_ctx->outer_context, decl,
+					     true);
+		    }
 		}
 	    }
 	  if (outer_ctx)


More information about the Gcc-cvs mailing list