This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[hsa] Gridification rewrite followups


Hi,

the following patch fixes a simple fallouts from the yesterday's
commit when a parallel child function was marked as a krnel, if it was
invoked from a gridified target construct.

The patch also fixes an ICE in the compiler when attempting to compile
OpenACC testcases (which then still fail wirth a sorry message later
on).

Committed to the branch.  Thanks,

Martin


2015-09-25  Martin Jambor  <mjambor@suse.cz>

	* omp-low.c (region_part_of_unkernelized_target_p): Renamed to
	region_part_of_target_p, changed not to return false on kernelized
	targets.  Updated all callers.
	(expand_target_kernel_body): Bail out if orig_child_fndecl is NULL.

diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 6ad9a5b..5e84588 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -5128,29 +5128,18 @@ gimple_build_cond_empty (tree cond)
 }
 
 /* Return true if the REGION is within a declare target function or within a
-   target region that has not been turned into a simple GPGPU kernel.  */
+   target region.  */
 
 static bool
-region_part_of_unkernelized_target_p (struct omp_region *region)
+region_part_of_target_p (struct omp_region *region)
 {
   if (lookup_attribute ("omp declare target",
 			DECL_ATTRIBUTES (current_function_decl)))
     return true;
 
-  region = region->outer;
-  while (region)
-    {
-      if (region->type == GIMPLE_OMP_TARGET)
-	{
-	  gomp_target *tgt_stmt;
-	  tgt_stmt = as_a <gomp_target *> (last_stmt (region->entry));
-	  if (tgt_stmt->kernel_iter)
-	    return false;
-	  else
-	    return true;
-	}
-      region = region->outer;
-    }
+  for (region = region->outer; region; region = region->outer)
+    if (region->type == GIMPLE_OMP_TARGET)
+      return true;
   return false;
 }
 
@@ -5324,7 +5313,7 @@ expand_parallel_call (struct omp_region *region, basic_block bb,
 			    false, GSI_CONTINUE_LINKING);
 
   if (hsa_gen_requested_p ()
-      && region_part_of_unkernelized_target_p (region))
+      && region_part_of_target_p (region))
     {
       cgraph_node *child_cnode = cgraph_node::get (child_fndecl);
       hsa_register_kernel (child_cnode);
@@ -9958,6 +9947,9 @@ expand_target_kernel_body (struct omp_region *target)
   tree orig_child_fndecl = gimple_omp_target_child_fn (tgt_stmt);
   if (!gpukernel)
     {
+      /* OpenACC target regions can have NULL orig_child_fndecl.  */
+      if (!orig_child_fndecl)
+	return;
       gcc_assert (!tgt_stmt->kernel_iter);
       cgraph_node *n = cgraph_node::get (orig_child_fndecl);
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]