[gomp4] ptx reduction simplification

Thomas Schwinge thomas@codesourcery.com
Tue Sep 22 15:12:00 GMT 2015


Hi!

On Fri, 18 Sep 2015 20:05:48 -0400, Nathan Sidwell <nathan@acm.org> wrote:
> I've committed this patch to rework and simplify [...]
> the reduction lowering hooks.
> 
> The current implementation [...]
> [was] overcomplicated in a number of ways.

> 	* omp-low.h (omp_reduction_init_op): Declare.
> 	* omp-low.c (omp_reduction_init_op): New, broken out of ...
> 	(omp_reduction_init): ... here.  Call it.
> 	* tree-parloops.c (initialize_reductions): Use
> 	omp_redutction_init_op.

Should this go into trunk already?  (I can test it, if you'd like me to.)

> --- tree-parloops.c	(revision 227903)
> +++ tree-parloops.c	(working copy)
> @@ -566,7 +566,7 @@ reduc_stmt_res (gimple stmt)
>  int
>  initialize_reductions (reduction_info **slot, struct loop *loop)
>  {
> -  tree init, c;
> +  tree init;
>    tree bvar, type, arg;
>    edge e;
>  
> @@ -582,12 +582,8 @@ initialize_reductions (reduction_info **
>    type = TREE_TYPE (PHI_RESULT (reduc->reduc_phi));
>    bvar = create_tmp_var (type, "reduction");
>  
> -  c = build_omp_clause (gimple_location (reduc->reduc_stmt),
> -			OMP_CLAUSE_REDUCTION);
> -  OMP_CLAUSE_REDUCTION_CODE (c) = reduc->reduction_code;
> -  OMP_CLAUSE_DECL (c) = SSA_NAME_VAR (reduc_stmt_res (reduc->reduc_stmt));
> -
> -  init = omp_reduction_init (c, TREE_TYPE (bvar));
> +  init = omp_reduction_init_op (gimple_location (reduc->reduc_stmt),
> +				reduc->reduction_code, type);
>    reduc->init = init;
>  
>    /* Replace the argument representing the initialization value

    [...]/source-gcc/gcc/tree-parloops.c: In function 'int initialize_reductions(reduction_info**, loop*)':
    [...]/source-gcc/gcc/tree-parloops.c:570:8: error: variable 'bvar' set but not used [-Werror=unused-but-set-variable]
       tree bvar, type, arg;
            ^

Committed to gomp-4_0-branch in r228016:

commit f858a76ae899a95b712beaaa8c110f708fd06a7a
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Tue Sep 22 15:07:23 2015 +0000

    Address -Werror=unused-but-set-variable diagnostic
    
    	gcc/
    	* tree-parloops.c (initialize_reductions): Remove local variable
    	bvar.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@228016 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog.gomp  |    5 +++++
 gcc/tree-parloops.c |    6 ++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp
index e70d6cb..b7dbba0 100644
--- gcc/ChangeLog.gomp
+++ gcc/ChangeLog.gomp
@@ -1,3 +1,8 @@
+2015-09-22  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* tree-parloops.c (initialize_reductions): Remove local variable
+	bvar.
+
 2015-09-18  Nathan Sidwell  <nathan@codesourcery.com>
 
 	* omp-low.h (omp_reduction_init_op): Declare.
diff --git gcc/tree-parloops.c gcc/tree-parloops.c
index 5062732..04ec254 100644
--- gcc/tree-parloops.c
+++ gcc/tree-parloops.c
@@ -567,7 +567,7 @@ int
 initialize_reductions (reduction_info **slot, struct loop *loop)
 {
   tree init;
-  tree bvar, type, arg;
+  tree type, arg;
   edge e;
 
   struct reduction_info *const reduc = *slot;
@@ -578,10 +578,8 @@ initialize_reductions (reduction_info **slot, struct loop *loop)
   /* In the phi node at the header, replace the argument coming
      from the preheader with the reduction initialization value.  */
 
-  /* Create a new variable to initialize the reduction.  */
+  /* Initialize the reduction.  */
   type = TREE_TYPE (PHI_RESULT (reduc->reduc_phi));
-  bvar = create_tmp_var (type, "reduction");
-
   init = omp_reduction_init_op (gimple_location (reduc->reduc_stmt),
 				reduc->reduction_code, type);
   reduc->init = init;


Grüße,
 Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150922/43ddbfa2/attachment.sig>


More information about the Gcc-patches mailing list