RE: [PATCH][Cilkplus]PR 53567

2012-06-17 Thread Iyer, Balaji V
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.i...@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.
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.i...@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

[PATCH][Cilkplus]PR 53567

2012-06-15 Thread Iyer, Balaji V
 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.Index: gcc/dwarf2out.c
===
--- gcc/dwarf2out.c (revision 188679)
+++ gcc/dwarf2out.c (working copy)
@@ -19548,6 +19548,12 @@
 static void
 dwarf2out_function_decl (tree decl)
 {
+  if (flag_enable_cilk  decl  TREE_CODE (decl) == FUNCTION_DECL)
+{
+  function *f = DECL_STRUCT_FUNCTION (decl);
+  if (f  f-is_cilk_helper_function)
+   return; /* can't do debuging output for spawn helper */
+}
   dwarf2out_decl (decl);
   call_arg_locations = NULL;
   call_arg_loc_last = NULL;
Index: gcc/ChangeLog.cilk
===
--- gcc/ChangeLog.cilk  (revision 188679)
+++ gcc/ChangeLog.cilk  (working copy)
@@ -1,3 +1,7 @@
+2012-06-15  Balaji V. Iyer  balaji.v.i...@intel.com  
+
+   * dwarf2out.c (dwarf2out_function_decl): Added a check for spawn helper.
+
 2012-06-15  Balaji V. Iyer  balaji.v.i...@intel.com
 
* cilk.c (install_builtin): Added a check if pushdecl is successful.