Fix 3 warnings in nvptx.c

Message ID 20190612073002.GT19695@tucnak
State New
Headers show
Series
  • Fix 3 warnings in nvptx.c
Related show

Commit Message

Jakub Jelinek June 12, 2019, 7:30 a.m.
Hi!

While testing the second PR90811 patch with nvptx offloading, I've noticed 3
warnings in nvptx.c.
The first two hunks are obvious, the last warning is about unused mode_label
variable.
Either we can do what the patch does, or another option is throw away
both the mode_jump and mode_label temporaries, keep the last hunk unmodified
and
-	*mode_jump = label_insn;
+	if (mode == GOMP_DIM_VECTOR)
+	  vector_jump = neuter_start;
+	else
+	  worker_jump = neuter_start;

2019-06-12  Jakub Jelinek  <jakub@redhat.com>

	* config/nvptx/nvptx.c (nvptx_sese_number, nvptx_sese_pseudo): Don't
	wrap ei variable name in the declaration in ()s.
	(nvptx_single): Actually use mode_label variable.  Formatting fix.


	Jakub

Comments

Tom de Vries June 13, 2019, 12:44 p.m. | #1
On 12-06-19 09:30, Jakub Jelinek wrote:
> Hi!

> 

> While testing the second PR90811 patch with nvptx offloading, I've noticed 3

> warnings in nvptx.c.

> The first two hunks are obvious, the last warning is about unused mode_label

> variable.

> Either we can do what the patch does, or another option is throw away

> both the mode_jump and mode_label temporaries, keep the last hunk unmodified

> and

> -	*mode_jump = label_insn;

> +	if (mode == GOMP_DIM_VECTOR)

> +	  vector_jump = neuter_start;

> +	else

> +	  worker_jump = neuter_start;

> 


Hi Jakub,

LGTM, thanks for fixing this.

My intention with the mode_jump/mode_label temporaries was to get more
straight line code, and the patch achieves this.

Thanks,
- Tom

> 2019-06-12  Jakub Jelinek  <jakub@redhat.com>

> 

> 	* config/nvptx/nvptx.c (nvptx_sese_number, nvptx_sese_pseudo): Don't

> 	wrap ei variable name in the declaration in ()s.

> 	(nvptx_single): Actually use mode_label variable.  Formatting fix.

> 

> --- gcc/config/nvptx/nvptx.c.jj	2019-06-11 23:21:28.068148871 +0200

> +++ gcc/config/nvptx/nvptx.c	2019-06-11 23:27:30.412633621 +0200

> @@ -3551,7 +3551,7 @@ nvptx_sese_number (int n, int p, int dir

>        size_t offset = (dir > 0 ? offsetof (edge_def, dest)

>  		       : offsetof (edge_def, src));

>        edge e;

> -      edge_iterator (ei);

> +      edge_iterator ei;

>  

>        FOR_EACH_EDGE (e, ei, edges)

>  	{

> @@ -3574,7 +3574,7 @@ nvptx_sese_pseudo (basic_block me, bb_se

>  		   vec<edge, va_gc> *edges, size_t offset)

>  {

>    edge e;

> -  edge_iterator (ei);

> +  edge_iterator ei;

>    int hi_back = depth;

>    pseudo_node_t node_back (0, depth);

>    int hi_child = depth;

> @@ -4402,8 +4402,10 @@ nvptx_single (unsigned mask, basic_block

>        {

>  	rtx_code_label *label = gen_label_rtx ();

>  	rtx pred = cfun->machine->axis_predicate[mode - GOMP_DIM_WORKER];

> -	rtx_insn **mode_jump = mode == GOMP_DIM_VECTOR ? &vector_jump : &worker_jump;

> -	rtx_insn **mode_label = mode == GOMP_DIM_VECTOR ? &vector_label : &worker_label;

> +	rtx_insn **mode_jump

> +	  = mode == GOMP_DIM_VECTOR ? &vector_jump : &worker_jump;

> +	rtx_insn **mode_label

> +	  = mode == GOMP_DIM_VECTOR ? &vector_label : &worker_label;

>  

>  	if (!pred)

>  	  {

> @@ -4437,10 +4439,7 @@ nvptx_single (unsigned mask, basic_block

>  	      emit_insn_after (gen_exit (), label_insn);

>  	  }

>  

> -	if (mode == GOMP_DIM_VECTOR)

> -	  vector_label = label_insn;

> -	else

> -	  worker_label = label_insn;

> +	*mode_label = label_insn;

>        }

>  

>    /* Now deal with propagating the branch condition.  */

> 

> 	Jakub

>

Patch

--- gcc/config/nvptx/nvptx.c.jj	2019-06-11 23:21:28.068148871 +0200
+++ gcc/config/nvptx/nvptx.c	2019-06-11 23:27:30.412633621 +0200
@@ -3551,7 +3551,7 @@  nvptx_sese_number (int n, int p, int dir
       size_t offset = (dir > 0 ? offsetof (edge_def, dest)
 		       : offsetof (edge_def, src));
       edge e;
-      edge_iterator (ei);
+      edge_iterator ei;
 
       FOR_EACH_EDGE (e, ei, edges)
 	{
@@ -3574,7 +3574,7 @@  nvptx_sese_pseudo (basic_block me, bb_se
 		   vec<edge, va_gc> *edges, size_t offset)
 {
   edge e;
-  edge_iterator (ei);
+  edge_iterator ei;
   int hi_back = depth;
   pseudo_node_t node_back (0, depth);
   int hi_child = depth;
@@ -4402,8 +4402,10 @@  nvptx_single (unsigned mask, basic_block
       {
 	rtx_code_label *label = gen_label_rtx ();
 	rtx pred = cfun->machine->axis_predicate[mode - GOMP_DIM_WORKER];
-	rtx_insn **mode_jump = mode == GOMP_DIM_VECTOR ? &vector_jump : &worker_jump;
-	rtx_insn **mode_label = mode == GOMP_DIM_VECTOR ? &vector_label : &worker_label;
+	rtx_insn **mode_jump
+	  = mode == GOMP_DIM_VECTOR ? &vector_jump : &worker_jump;
+	rtx_insn **mode_label
+	  = mode == GOMP_DIM_VECTOR ? &vector_label : &worker_label;
 
 	if (!pred)
 	  {
@@ -4437,10 +4439,7 @@  nvptx_single (unsigned mask, basic_block
 	      emit_insn_after (gen_exit (), label_insn);
 	  }
 
-	if (mode == GOMP_DIM_VECTOR)
-	  vector_label = label_insn;
-	else
-	  worker_label = label_insn;
+	*mode_label = label_insn;
       }
 
   /* Now deal with propagating the branch condition.  */