diff mbox

[Cilkplus] PR 53567

Message ID BF230D13CA30DD48930C31D4099330000F276043@FMSMSX102.amr.corp.intel.com
State New
Headers show

Commit Message

Iyer, Balaji V June 18, 2012, 1:58 a.m. UTC
Hello Everyone,
	I missed one case where bug comes up again. This patch should fix that.

Thanks,

Balaji V. Iyer.

-----Original Message-----
From: Iyer, Balaji V [mailto:balaji.v.iyer@intel.com] 
Sent: Friday, June 15, 2012 3:37 PM
To: gcc-patches@gcc.gnu.org
Subject: [PATCH][Cilkplus]PR 53567

 Hello Everyone,
    This patch is for the Cilkplus branch affecting both C and C++ compilers. The dwarf output function was looking for debugging information for an internally generated spawn helper which is not there. So this patch will make sure that those functions are excluded.

Thanks,

Balaji V. Iyer.
diff mbox

Patch

Index: gcc/tree.h
===================================================================
--- gcc/tree.h	(revision 188714)
+++ gcc/tree.h	(working copy)
@@ -520,6 +520,7 @@ 
   unsigned deprecated_flag : 1;
   unsigned saturating_flag : 1;
   unsigned is_cilk_spawn : 1;
+  unsigned is_cilk_helper_fn : 1;
   unsigned default_def_flag : 1;
   unsigned lang_flag_0 : 1;
   unsigned lang_flag_1 : 1;
@@ -1891,6 +1892,10 @@ 
 	(TREE_CODE(N) == CALL_EXPR || TREE_CODE(N) == FUNCTION_DECL)
 #define SPAWN_CALL_P(N) (/* FUNCTION_DECL_CALL_CHECK */(N)->base.is_cilk_spawn)
 
+/* True if the function is a cilk helper function or something that cilk
+   touches */
+#define CILK_FN_P(N) (N->base.is_cilk_helper_fn)
+
 /* True if this call is the point at which a wrapper should detach. */
 #define SPAWN_DETACH_POINT(NODE) (CALL_EXPR_CHECK (NODE)->base.default_def_flag)
 
Index: gcc/cp/cilk.c
===================================================================
--- gcc/cp/cilk.c	(revision 188714)
+++ gcc/cp/cilk.c	(working copy)
@@ -585,6 +585,7 @@ 
      the uncopyable value in the outer frame. */
 
   cfun->is_cilk_function = 1;
+  CILK_FN_P (cfun->decl) = 1;
   pre = 0;
   lower_bound = cfd->lower_bound;
   if (!lower_bound)
@@ -833,7 +834,7 @@ 
   tree decl = cfun->cilk_frame_decl;
 
   cfun->is_cilk_function = 1;
-  
+  CILK_FN_P (cfun->decl) = 1;
   if (!decl)
     {
       tree addr, body, ctor, dtor, obody;
Index: gcc/cp/ChangeLog.cilk
===================================================================
--- gcc/cp/ChangeLog.cilk	(revision 188714)
+++ gcc/cp/ChangeLog.cilk	(working copy)
@@ -1,3 +1,8 @@ 
+2012-06-17  balaji.v.iyer  <bviyer@nhelv406>
+
+	* cilk.c (cp_build_cilk_for_body): Set CILK_FN_P field to 1.
+	(cp_make_cilk_frame): Likewise.
+
 2012-06-14  Balaji V. Iyer  <balaji.v.iyer@intel.com>
 
 	* pt.c (tsubst_expr): Added a check for CILK_SYNC statement.
Index: gcc/cilk.c
===================================================================
--- gcc/cilk.c	(revision 188714)
+++ gcc/cilk.c	(working copy)
@@ -1105,7 +1105,8 @@ 
   if (cfun) 
     { 
       cfun->calls_notify_intrinsic = 1;
-      cfun->is_cilk_function = 1; 
+      cfun->is_cilk_function = 1;
+      CILK_FN_P (cfun->decl) = 1;
     }
 
   return const0_rtx;
@@ -1184,3 +1185,4 @@ 
   
   return;
 }
+
Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c	(revision 188714)
+++ gcc/dwarf2out.c	(working copy)
@@ -16565,6 +16565,14 @@ 
   /* Make sure we have the actual abstract inline, not a clone.  */
   decl = DECL_ORIGIN (decl);
 
+  if (flag_enable_cilk && decl && TREE_CODE (decl) == FUNCTION_DECL)
+    {
+      struct function *f = DECL_STRUCT_FUNCTION (decl);
+      if (f && f->is_cilk_helper_function)
+	return; /* can't do debuging output for spawn helper */
+      else if (!f && CILK_FN_P (decl))
+	return; /* can't do it if it is a cilk function and f is NULL */
+    }
   old_die = lookup_decl_die (decl);
   if (old_die && get_AT (old_die, DW_AT_inline))
     /* We've already generated the abstract instance.  */
@@ -19553,6 +19561,8 @@ 
       struct function *f = DECL_STRUCT_FUNCTION (decl);
       if (f && f->is_cilk_helper_function)
 	return; /* can't do debuging output for spawn helper */
+      else if (!f && CILK_FN_P (decl))
+	return;
     }
   dwarf2out_decl (decl);
   call_arg_locations = NULL;
Index: gcc/cilk-spawn.c
===================================================================
--- gcc/cilk-spawn.c	(revision 188714)
+++ gcc/cilk-spawn.c	(working copy)
@@ -129,6 +129,7 @@ 
 
   f->is_cilk_function = 1;
   f->is_cilk_helper_function = 1;
+  CILK_FN_P (fndecl) = 1;
   /* gimplify_body may garbage collect.  Save a root. */
   cilk_trees[CILK_TI_PENDING_FUNCTIONS] =
     tree_cons (NULL_TREE, fndecl, cilk_trees[CILK_TI_PENDING_FUNCTIONS]);
@@ -388,7 +389,7 @@ 
 
   cfun->calls_spawn = 1;
   cfun->is_cilk_function = 1;
-  
+  CILK_FN_P (cfun->decl) = 1;
 
   /* Convert this statement into a nested function, using capture
      by value when that is equivalent but faster. */
@@ -2549,7 +2550,7 @@ 
   set_cfun (DECL_STRUCT_FUNCTION (current_function_decl));
 
   cfun->is_cilk_function = 1;
-  
+  CILK_FN_P (cfun->decl) = 1;
   /* Apparently we need to gimplify now because we can't leave
      non-GIMPLE functions lying around. */
   cg_hacks (fn, &cfd->wd); 
@@ -2778,7 +2779,7 @@ 
   *expr_p = NULL_TREE;
 
   cfun->is_cilk_function = 1;
-  
+  CILK_FN_P (cfun->decl) = 1;
   init_cfd (&cfd);
 
   cfd.wd.block = block_for_loop (loop);
Index: gcc/ChangeLog.cilk
===================================================================
--- gcc/ChangeLog.cilk	(revision 188714)
+++ gcc/ChangeLog.cilk	(working copy)
@@ -1,3 +1,17 @@ 
+2012-06-17  balaji.v.iyer  <bviyer@nhelv406>
+
+	PR 53672
+	* dwarf2out.c (dwarf2out_abstract_function): Added a check for the
+	spawn helper.
+	(dwarf2out_function_decl): Added a check if CILK_FN_P is set when there
+	is no function struct.
+	* cilk.c (expand_builtin_cilk_metadata): Set the CILK_FN_P field to 1.
+	* cilk-spawn.c (cg-hacks): Likewise.
+	(gimplify_cilk_for_2): Likewise.
+	(gimplify_cilk_for): Likewise.
+
+	* tree.h (CILK_FN_P): Added new #define to access a base field of tree.
+
 2012-06-15  Balaji V. Iyer  <balaji.v.iyer@intel.com>
 
 	PR 53672