diff mbox

[OpenACC] minor code cleanup

Message ID 5d5905a8-a3b1-4949-3d4e-f29467eb8734@acm.org
State New
Headers show

Commit Message

Nathan Sidwell May 2, 2016, 6:16 p.m. UTC
While working on some more loop partitioning improvements, I noticed some 
unnecessary checking.  By construction an openacc loop must have at least one 
head/tail marker, so we should assert that earlier when lowering the loop (in 
the common compiler) and then rely  on it later when processing the loop (in the 
accelerator compiler).

ok for trunk?

nathan

Comments

Jakub Jelinek May 2, 2016, 6:19 p.m. UTC | #1
On Mon, May 02, 2016 at 02:16:25PM -0400, Nathan Sidwell wrote:
> While working on some more loop partitioning improvements, I noticed some
> unnecessary checking.  By construction an openacc loop must have at least
> one head/tail marker, so we should assert that earlier when lowering the
> loop (in the common compiler) and then rely  on it later when processing the
> loop (in the accelerator compiler).
> 
> ok for trunk?
> 
> nathan

> 2016-05-02  Nathan Sidwell  <nathan@codesourcery.com>
> 
> 	* omp-low.c (lower_oacc_head_tail): Assert there is at least one
> 	marker.
> 	(oacc_loop_process): Check mask for loop termination.

Ok.

	Jakub
diff mbox

Patch

2016-05-02  Nathan Sidwell  <nathan@codesourcery.com>

	* omp-low.c (lower_oacc_head_tail): Assert there is at least one
	marker.
	(oacc_loop_process): Check mask for loop termination.

Index: omp-low.c
===================================================================
--- omp-low.c	(revision 235758)
+++ omp-low.c	(working copy)
@@ -6402,12 +6402,10 @@  lower_oacc_head_tail (location_t loc, tr
   gimple_seq_add_stmt (head, gimple_build_assign (ddvar, integer_zero_node));
 
   unsigned count = lower_oacc_head_mark (loc, ddvar, clauses, head, ctx);
-  if (!count)
-    lower_oacc_loop_marker (loc, ddvar, false, integer_zero_node, tail);
-  
   tree fork_kind = build_int_cst (unsigned_type_node, IFN_UNIQUE_OACC_FORK);
   tree join_kind = build_int_cst (unsigned_type_node, IFN_UNIQUE_OACC_JOIN);
 
+  gcc_assert (count);
   for (unsigned done = 1; count; count--, done++)
     {
       gimple_seq fork_seq = NULL;
@@ -19331,10 +19329,8 @@  oacc_loop_process (oacc_loop *loop)
 
       oacc_loop_xform_loop (loop->head_end, loop->ifns, mask_arg, chunk_arg);
 
-      for (ix = 0; ix != GOMP_DIM_MAX && loop->heads[ix]; ix++)
+      for (ix = 0; ix != GOMP_DIM_MAX && mask; ix++)
 	{
-	  gcc_assert (mask);
-
 	  while (!(GOMP_DIM_MASK (dim) & mask))
 	    dim++;