This patch uses a more appropriate local variable in the call to
localize_reductions in gimplify_omp_for, for better self-documentation.

Tested with offloading to AMD GCN. I will apply to the
openacc-gcc-9-branch shortly.

Julian

ChangeLog

        gcc/
        * gimplify.c (gimplify_omp_for): Use for_stmt in call to
        localize_reductions.
---
 gcc/ChangeLog.openacc | 5 +++++
 gcc/gimplify.c        | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog.openacc b/gcc/ChangeLog.openacc
index ffe19bc5809..02667a2aed4 100644
--- a/gcc/ChangeLog.openacc
+++ b/gcc/ChangeLog.openacc
@@ -1,3 +1,8 @@
+2019-09-06  Julian Brown  <jul...@codesourcery.com>
+
+       * gimplify.c (gimplify_omp_for): Use for_stmt in call to
+       localize_reductions.
+
 2019-09-06  Julian Brown  <jul...@codesourcery.com>
 
        * config/nvptx/nvptx.c (omp-sese.h): Include.
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 3d869447d70..60761504a5e 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -11082,7 +11082,8 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p)
         here, because the code to remove reductions in kernels regions cannot
         handle that.  */
       if (outer && outer->region_type == ORT_ACC_PARALLEL)
-       localize_reductions (OMP_FOR_CLAUSES (*expr_p), OMP_FOR_BODY (*expr_p));
+       localize_reductions (OMP_FOR_CLAUSES (for_stmt),
+                            OMP_FOR_BODY (for_stmt));
     }
 
   /* Set OMP_CLAUSE_LINEAR_NO_COPYIN flag on explicit linear
-- 
2.22.0

Reply via email to