]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Handle references in OpenACC "private" clauses
authorJulian Brown <julian@codesourcery.com>
Fri, 20 Sep 2019 20:53:10 +0000 (13:53 -0700)
committerKwok Cheung Yeung <kcy@codesourcery.com>
Tue, 21 Jun 2022 13:11:20 +0000 (14:11 +0100)
gcc/
* gimplify.cc (localize_reductions): Rewrite references for
OMP_CLAUSE_PRIVATE also.

gcc/ChangeLog.omp
gcc/gimplify.cc

index fd91f876cc850efb6c4c82257989bb16744f7e77..84ebebbe7b60a2fcc444db449a7d33d6bcad1bee 100644 (file)
@@ -1,3 +1,8 @@
+2019-09-20  Julian Brown  <julian@codesourcery.com>
+
+       * gimplify.cc (localize_reductions): Rewrite references for
+       OMP_CLAUSE_PRIVATE also.
+
 2019-09-17  Tobias Burnus  <tobias@codesourcery.com>
 
        * gimplify.cc (gomp_oacc_needs_data_present): Remove unused variable.
index 76564c69249e46d1c43bfa4ef42b19d30a61c38f..576633ecf3d800ec504d2eb51af43eb314d47629 100644 (file)
@@ -12610,6 +12610,21 @@ localize_reductions (tree clauses, tree body)
 
        OMP_CLAUSE_REDUCTION_PRIVATE_DECL (c) = new_var;
       }
+    else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_PRIVATE)
+      {
+       var = OMP_CLAUSE_DECL (c);
+
+       if (!lang_hooks.decls.omp_privatize_by_reference (var))
+         continue;
+
+       type = TREE_TYPE (TREE_TYPE (var));
+       new_var = create_tmp_var (type, IDENTIFIER_POINTER (DECL_NAME (var)));
+
+       pr.ref_var = var;
+       pr.local_var = new_var;
+
+       walk_tree (&body, localize_reductions_r, &pr, NULL);
+      }
 }