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]

Re: PR 23551: why should we coalesce inlined variables?


On Jul 11, 2007, "Daniel Berlin" <dberlin@dberlin.org> wrote:

> I know what dwarf3 says, because i suggested modifications to the text.
> You said "dwarf2+".

My copy of dwarf2 is not significantly different.  It states:

2. An ending address, again relative to the base address of the
   compilation unit referencing this location list. It marks the first
   address past the end of the address range over which the location
   is valid.

>> Which is why the annotations I intend to create won't be
>> copy-propagated away, doh!

> Whatever dude. I'm sure you will get right what everyone else has
> gotten wrong for so many years, and create magical debug info that
> neither is destroyed by optimization, nor needs to be updated all the
> time, nor gets in the way of optimization.

> Good luck, i await your patches.

Here's what I've got so far.  It completed a C-only bootstraps on
i686-linux-gnu, and it's just started stage3 for all languages on
x86_64-linux-gnu.  (Ada is still broken on i686-linux-gnu because of
sccvn, BTW)

It doesn't change the way debug info is constructed yet, but the
annotations are all there, ready to be used for this purpose.  I
haven't decided whether to emit them with -g<2; I have to do some
testing about it first to tell whether it affects the generated code.

I was thinking of introducing a bootstrap-debug target, that would
build stage2 without -g, and stage3 with -g, then compare object files
after strip -g in the stage3 object files.  Does anyone have prior
experience with comparing object files constructed like this to tell
whether they are likely to compare equal?  (i.e., whether
bootstrap-debug would be generally useful as an additional compiler
test)

Never mind the incomplete ChangeLog entry.  It's inherited from
another patch and just a starting point; I haven't bothered to write
ChangeLog entries yet for the WIP patch yet.

for  gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* tree-ssa-copyrename.c (copy_rename_partition_coalesce):
	Permit coalescing of user variables.

Index: gcc/tree-ssa-copyrename.c
===================================================================
--- gcc/tree-ssa-copyrename.c.orig	2007-07-11 02:36:55.000000000 -0300
+++ gcc/tree-ssa-copyrename.c	2007-07-11 02:43:05.000000000 -0300
@@ -191,22 +191,6 @@ copy_rename_partition_coalesce (var_map 
   ign1 = TREE_CODE (root1) == VAR_DECL && DECL_IGNORED_P (root1);
   ign2 = TREE_CODE (root2) == VAR_DECL && DECL_IGNORED_P (root2);
 
-  /* Never attempt to coalesce 2 user variables unless one is an inline 
-     variable.  */
-  if (!ign1 && !ign2)
-    {
-      if (DECL_FROM_INLINE (root2))
-        ign2 = true;
-      else if (DECL_FROM_INLINE (root1))
-	ign1 = true;
-      else 
-	{
-	  if (debug)
-	    fprintf (debug, " : 2 different USER vars. No coalesce.\n");
-	  return false;
-	}
-    }
-
   /* Don't coalesce if there are two different memory tags.  */
   if (ann1->symbol_mem_tag
       && ann2->symbol_mem_tag
Index: gcc/tree-inline.c
===================================================================
--- gcc/tree-inline.c.orig	2007-07-11 02:36:55.000000000 -0300
+++ gcc/tree-inline.c	2007-07-11 04:29:23.000000000 -0300
@@ -1255,25 +1255,9 @@ copy_body (copy_body_data *id, gcov_type
   return body;
 }
 
-/* Return true if VALUE is an ADDR_EXPR of an automatic variable
-   defined in function FN, or of a data member thereof.  */
-
-static bool
-self_inlining_addr_expr (tree value, tree fn)
-{
-  tree var;
-
-  if (TREE_CODE (value) != ADDR_EXPR)
-    return false;
-
-  var = get_base_address (TREE_OPERAND (value, 0));
-
-  return var && lang_hooks.tree_inlining.auto_var_in_fn_p (var, fn);
-}
-
 static void
-setup_one_parameter (copy_body_data *id, tree p, tree value, tree fn,
-		     basic_block bb, tree *vars)
+setup_one_parameter (copy_body_data *id, tree p, tree value,
+		     tree fn ATTRIBUTE_UNUSED, basic_block bb, tree *vars)
 {
   tree init_stmt;
   tree var;
@@ -1287,33 +1271,6 @@ setup_one_parameter (copy_body_data *id,
       && !useless_type_conversion_p (TREE_TYPE (p), TREE_TYPE (value)))
     rhs = fold_build1 (NOP_EXPR, TREE_TYPE (p), value);
 
-  /* If the parameter is never assigned to, has no SSA_NAMEs created,
-     we may not need to create a new variable here at all.  Instead, we may
-     be able to just use the argument value.  */
-  if (TREE_READONLY (p)
-      && !TREE_ADDRESSABLE (p)
-      && value && !TREE_SIDE_EFFECTS (value)
-      && !def)
-    {
-      /* We may produce non-gimple trees by adding NOPs or introduce
-	 invalid sharing when operand is not really constant.
-	 It is not big deal to prohibit constant propagation here as
-	 we will constant propagate in DOM1 pass anyway.  */
-      if (is_gimple_min_invariant (value)
-	  && useless_type_conversion_p (TREE_TYPE (p),
-						 TREE_TYPE (value))
-	  /* We have to be very careful about ADDR_EXPR.  Make sure
-	     the base variable isn't a local variable of the inlined
-	     function, e.g., when doing recursive inlining, direct or
-	     mutually-recursive or whatever, which is why we don't
-	     just test whether fn == current_function_decl.  */
-	  && ! self_inlining_addr_expr (value, fn))
-	{
-	  insert_decl_map (id, p, value);
-	  return;
-	}
-    }
-
   /* Make an equivalent VAR_DECL.  Note that we must NOT remap the type
      here since the type of this decl must be visible to the calling
      function.  */
@@ -1361,29 +1318,6 @@ setup_one_parameter (copy_body_data *id,
   if (TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (p)))
     TREE_READONLY (var) = 0;
 
-  /* If there is no setup required and we are in SSA, take the easy route
-     replacing all SSA names representing the function parameter by the
-     SSA name passed to function.
-
-     We need to construct map for the variable anyway as it might be used
-     in different SSA names when parameter is set in function.
-
-     FIXME: This usually kills the last connection in between inlined
-     function parameter and the actual value in debug info.  Can we do
-     better here?  If we just inserted the statement, copy propagation
-     would kill it anyway as it always did in older versions of GCC.
-
-     We might want to introduce a notion that single SSA_NAME might
-     represent multiple variables for purposes of debugging. */
-  if (gimple_in_ssa_p (cfun) && rhs && def && is_gimple_reg (p)
-      && (TREE_CODE (rhs) == SSA_NAME
-	  || is_gimple_min_invariant (rhs))
-      && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (def))
-    {
-      insert_decl_map (id, def, rhs);
-      return;
-    }
-
   /* Initialize this VAR_DECL from the equivalent argument.  Convert
      the argument to the proper type in case it was promoted.  */
   if (value)
@@ -2026,8 +1960,9 @@ estimate_num_insns_1 (tree *tp, int *wal
       *walk_subtrees = 0;
       return NULL;
 
-      /* CHANGE_DYNAMIC_TYPE_EXPR explicitly expands to nothing.  */
+      /* These explicitly expand to nothing.  */
     case CHANGE_DYNAMIC_TYPE_EXPR:
+    case VAR_DEBUG_VALUE:
       *walk_subtrees = 0;
       return NULL;
 
Index: gcc/tree-into-ssa.c
===================================================================
--- gcc/tree-into-ssa.c.orig	2007-07-11 02:36:55.000000000 -0300
+++ gcc/tree-into-ssa.c	2007-07-11 02:43:05.000000000 -0300
@@ -1,5 +1,5 @@
 /* Rewrite a program in Normal form into SSA.
-   Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
    Contributed by Diego Novillo <dnovillo@redhat.com>
 
 This file is part of GCC.
@@ -253,7 +253,6 @@ enum rewrite_mode {
    registered, but they don't need to have their uses renamed.  */
 #define REGISTER_DEFS_IN_THIS_STMT(T)	(T)->base.unsigned_flag
 
-
 /* Prototypes for debugging functions.  */
 extern void dump_tree_ssa (FILE *);
 extern void debug_tree_ssa (void);
@@ -1104,6 +1103,27 @@ mark_phi_for_rewrite (basic_block bb, tr
   VEC_replace (tree_vec, phis_to_rewrite, idx, phis);
 }
 
+/* Decide whether to emit a VAR_DEBUG_VALUE annotation for VAR.  */
+
+static inline bool
+var_debug_value_for_decl (tree var)
+{
+  if (TREE_CODE (var) != VAR_DECL
+      && TREE_CODE (var) != PARM_DECL)
+    return false;
+
+  if (DECL_IGNORED_P (var))
+    return false;
+
+  if (debug_info_level < DINFO_LEVEL_NORMAL)
+    return false;
+
+  if (!is_gimple_reg (var))
+    return false;
+
+  return true;
+}
+
 
 /* Insert PHI nodes for variable VAR using the iterated dominance
    frontier given in PHI_INSERTION_POINTS.  If UPDATE_P is true, this
@@ -1173,6 +1193,18 @@ insert_phi_nodes_for (tree var, bitmap p
 	{
 	  tree sym = DECL_P (var) ? var : SSA_NAME_VAR (var);
 	  phi = create_phi_node (sym, bb);
+	  if (var_debug_value_for_decl (sym))
+	    {
+	      tree note = build_var_debug_value (sym, PHI_RESULT (phi));
+	      block_stmt_iterator si = bsi_start (bb);
+	      for (;!bsi_end_p (si); bsi_next (&si))
+		{
+		  tree tmp = bsi_stmt (si);
+		  if (TREE_CODE (tmp) != LABEL_EXPR)
+		    break;
+		}
+	      bsi_insert_before (&si, note, BSI_SAME_STMT);
+	    }
 	}
 
       /* Mark this PHI node as interesting for update_ssa.  */
@@ -1378,9 +1410,14 @@ rewrite_stmt (struct dom_walk_data *walk
   if (REGISTER_DEFS_IN_THIS_STMT (stmt))
     FOR_EACH_SSA_DEF_OPERAND (def_p, stmt, iter, SSA_OP_DEF)
       {
-	tree var = DEF_FROM_PTR (def_p);
+	tree var = DEF_FROM_PTR (def_p), name;
 	gcc_assert (DECL_P (var));
-	SET_DEF (def_p, make_ssa_name (var, stmt));
+	SET_DEF (def_p, name = make_ssa_name (var, stmt));
+	if (var_debug_value_for_decl (var))
+	  {
+	    tree note = build_var_debug_value (var, name);
+	    bsi_insert_after (&si, note, BSI_SAME_STMT);
+	  }
 	register_new_def (DEF_FROM_PTR (def_p), var);
       }
 }
Index: gcc/tree.c
===================================================================
--- gcc/tree.c.orig	2007-07-11 02:36:55.000000000 -0300
+++ gcc/tree.c	2007-07-11 02:43:05.000000000 -0300
@@ -3124,6 +3124,21 @@ build_gimple_modify_stmt_stat (tree arg0
   return t;
 }
 
+/* Build a VAR_DEBUG_VALUE node.  This tree code doesn't have a
+   type, so we can't use build2 (a.k.a. build2_stat).  */
+
+tree
+build_var_debug_value_stat (tree arg0, tree arg1 MEM_STAT_DECL)
+{
+  tree t;
+
+  t = make_node_stat (VAR_DEBUG_VALUE PASS_MEM_STAT);
+  /* ?? We don't care about setting flags for tuples...  */
+  VAR_DEBUG_VALUE_SET_VAR (t, arg0);
+  VAR_DEBUG_VALUE_VALUE (t) = arg1;
+  return t;
+}
+
 tree
 build3_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
 	     tree arg2 MEM_STAT_DECL)
Index: gcc/tree.def
===================================================================
--- gcc/tree.def.orig	2007-07-11 02:36:55.000000000 -0300
+++ gcc/tree.def	2007-07-11 02:43:05.000000000 -0300
@@ -1090,6 +1090,10 @@ DEFTREECODE (VEC_RSHIFT_EXPR, "vec_rshif
 /* Assignment expression.  Operand 0 is the what to set; 1, the new value.  */
 DEFTREECODE (GIMPLE_MODIFY_STMT, "gimple_modify_stmt", tcc_gimple_stmt, 2)
 
+/* Debug annotation.  Operand 0 is a user variable; 1 is an expression
+   with its value, for purposes of debug information.  */
+DEFTREECODE (VAR_DEBUG_VALUE, "var_debug_value", tcc_gimple_stmt, 2)
+
 /* Widening vector multiplication.
    The two operands are vectors with N elements of size S. Multiplying the
    elements of the two vectors will result in N products of size 2*S.
Index: gcc/tree.h
===================================================================
--- gcc/tree.h.orig	2007-07-11 02:36:55.000000000 -0300
+++ gcc/tree.h	2007-07-11 04:11:21.000000000 -0300
@@ -820,6 +820,32 @@ enum tree_node_structure_enum {
 				 __FILE__, __LINE__, __FUNCTION__);	\
     &__t->gstmt.operands[__i]; }))
 
+/* Set the variable set by the VAR_DEBUG_VALUE stmt.  */
+#define VAR_DEBUG_VALUE_SET_VAR(T, V) __extension__			\
+  ({const tree __t = VAR_DEBUG_VALUE_CHECK (T);				\
+    if (0 >= TREE_OPERAND_LENGTH (__t))					\
+      tree_operand_check_failed (0, __t,				\
+				 __FILE__, __LINE__, __FUNCTION__);	\
+    __t->gstmt.operands[0] = (V); })
+
+/* Rvalue for the variable set by the VAR_DEBUG_VALUE stmt.  */
+#define VAR_DEBUG_VALUE_VAR(T) __extension__				\
+  ({const tree __t = VAR_DEBUG_VALUE_CHECK (T);				\
+    tree __var;								\
+    if (0 >= TREE_OPERAND_LENGTH (__t))					\
+      tree_operand_check_failed (0, __t,				\
+				 __FILE__, __LINE__, __FUNCTION__);	\
+    __var = __t->gstmt.operands[0];					\
+    __var; })
+
+/* Lvalue for the value of the variable.  */
+#define VAR_DEBUG_VALUE_VALUE(T) __extension__				\
+(*({const tree __t = VAR_DEBUG_VALUE_CHECK (T);				\
+    if (1 >= TREE_OPERAND_LENGTH (__t))					\
+      tree_operand_check_failed (1, __t,				\
+				 __FILE__, __LINE__, __FUNCTION__);	\
+    &__t->gstmt.operands[1]; }))
+
 #define TREE_RTL_OPERAND_CHECK(T, CODE, I) __extension__		\
 (*(rtx *)								\
  ({const tree __t = (T);						\
@@ -917,6 +943,9 @@ extern void omp_clause_range_check_faile
 #define TREE_OPERAND_CHECK(T, I)		((T)->exp.operands[I])
 #define TREE_OPERAND_CHECK_CODE(T, CODE, I)	((T)->exp.operands[I])
 #define GIMPLE_STMT_OPERAND_CHECK(T, I)		((T)->gstmt.operands[I])
+#define VAR_DEBUG_VALUE_SET_VAR(T, V)		((T)->gstmt.operands[0] = (V))
+#define VAR_DEBUG_VALUE_VAR(T, V)		((tree)(T)->gstmt.operands[0])
+#define VAR_DEBUG_VALUE_VALUE(T, V)		((T)->gstmt.operands[1])
 #define TREE_RTL_OPERAND_CHECK(T, CODE, I)  (*(rtx *) &((T)->exp.operands[I]))
 #define PHI_NODE_ELT_CHECK(T, i)	((T)->phi.a[i])
 #define OMP_CLAUSE_ELT_CHECK(T, i)	        ((T)->omp_clause.ops[i])
@@ -1543,6 +1572,10 @@ struct tree_constructor GTY(())
 #define GIMPLE_STMT_LOCUS(NODE) (GIMPLE_STMT_CHECK (NODE)->gstmt.locus)
 #define GIMPLE_STMT_BLOCK(NODE) (GIMPLE_STMT_CHECK (NODE)->gstmt.block)
 
+/* The second operand of a VAR_DEBUG_VALUE when the value was
+   optimized away.  */
+#define VAR_DEBUG_VALUE_NOVALUE error_mark_node
+
 /* In a LOOP_EXPR node.  */
 #define LOOP_EXPR_BODY(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_EXPR, 0)
 
@@ -3756,6 +3789,10 @@ extern tree build_gimple_modify_stmt_sta
 #define build_gimple_modify_stmt(t1,t2) \
   build_gimple_modify_stmt_stat (t1,t2 MEM_STAT_INFO)
 
+extern tree build_var_debug_value_stat (tree, tree MEM_STAT_DECL);
+#define build_var_debug_value(t1,t2) \
+  build_var_debug_value_stat (t1,t2 MEM_STAT_INFO)
+
 extern tree build_int_cst (tree, HOST_WIDE_INT);
 extern tree build_int_cst_type (tree, HOST_WIDE_INT);
 extern tree build_int_cstu (tree, unsigned HOST_WIDE_INT);
Index: gcc/tree-gimple.c
===================================================================
--- gcc/tree-gimple.c.orig	2007-07-11 02:36:55.000000000 -0300
+++ gcc/tree-gimple.c	2007-07-11 02:43:05.000000000 -0300
@@ -243,6 +243,7 @@ is_gimple_stmt (tree t)
 
     case CALL_EXPR:
     case GIMPLE_MODIFY_STMT:
+    case VAR_DEBUG_VALUE:
       /* These are valid regardless of their type.  */
       return true;
 
Index: gcc/tree-ssa-operands.c
===================================================================
--- gcc/tree-ssa-operands.c.orig	2007-07-11 02:36:55.000000000 -0300
+++ gcc/tree-ssa-operands.c	2007-07-11 03:43:42.000000000 -0300
@@ -2129,6 +2129,11 @@ get_expr_operands (tree stmt, tree *expr
       get_modify_stmt_operands (stmt, expr);
       return;
 
+    case VAR_DEBUG_VALUE:
+      if (VAR_DEBUG_VALUE_VALUE (stmt) != VAR_DEBUG_VALUE_NOVALUE)
+	get_expr_operands (stmt, &VAR_DEBUG_VALUE_VALUE (stmt), opf_use);
+      return;
+
     case CONSTRUCTOR:
       {
 	/* General aggregate CONSTRUCTORs have been decomposed, but they
@@ -2229,6 +2234,11 @@ parse_ssa_operands (tree stmt)
       get_modify_stmt_operands (stmt, stmt);
       break;
 
+    case VAR_DEBUG_VALUE:
+      if (VAR_DEBUG_VALUE_VALUE (stmt) != VAR_DEBUG_VALUE_NOVALUE)
+	get_expr_operands (stmt, &VAR_DEBUG_VALUE_VALUE (stmt), opf_use);
+      return;
+
     case COND_EXPR:
       get_expr_operands (stmt, &COND_EXPR_COND (stmt), opf_use);
       break;
Index: gcc/tree-dump.c
===================================================================
--- gcc/tree-dump.c.orig	2007-07-11 02:36:55.000000000 -0300
+++ gcc/tree-dump.c	2007-07-11 02:43:05.000000000 -0300
@@ -1,5 +1,5 @@
 /* Tree-dumping functionality for intermediate representation.
-   Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006
+   Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007
    Free Software Foundation, Inc.
    Written by Mark Mitchell <mark@codesourcery.com>
 
@@ -582,6 +582,11 @@ dequeue_and_dump (dump_info_p di)
       dump_child ("op 1", GIMPLE_STMT_OPERAND (t, 1));
       break;
 
+    case VAR_DEBUG_VALUE:
+      dump_child ("op 0", VAR_DEBUG_VALUE_VAR (t));
+      dump_child ("op 0", VAR_DEBUG_VALUE_VALUE (t));
+      break;
+
     case COMPONENT_REF:
       dump_child ("op 0", TREE_OPERAND (t, 0));
       dump_child ("op 1", TREE_OPERAND (t, 1));
Index: gcc/tree-pretty-print.c
===================================================================
--- gcc/tree-pretty-print.c.orig	2007-07-11 02:36:55.000000000 -0300
+++ gcc/tree-pretty-print.c	2007-07-11 02:50:58.000000000 -0300
@@ -1071,6 +1071,14 @@ dump_generic_node (pretty_printer *buffe
 	  		 false);
       break;
 
+    case VAR_DEBUG_VALUE:
+      pp_string (buffer, "# DEBUG ");
+      dump_generic_node (buffer, VAR_DEBUG_VALUE_VAR (node), spc, flags, false);
+      pp_string (buffer, " = ");
+      dump_generic_node (buffer, VAR_DEBUG_VALUE_VALUE (node), spc, flags,
+			 false);
+      break;
+
     case TARGET_EXPR:
       pp_string (buffer, "TARGET_EXPR <");
       dump_generic_node (buffer, TARGET_EXPR_SLOT (node), spc, flags, false);
Index: gcc/tree-ssa-dce.c
===================================================================
--- gcc/tree-ssa-dce.c.orig	2007-07-11 02:36:55.000000000 -0300
+++ gcc/tree-ssa-dce.c	2007-07-11 04:10:59.000000000 -0300
@@ -318,6 +318,10 @@ mark_stmt_if_obviously_necessary (tree s
 	}
       break;
 
+    case VAR_DEBUG_VALUE:
+      mark_stmt_necessary (stmt, false);
+      return;
+
     case GOTO_EXPR:
       gcc_assert (!simple_goto_p (stmt));
       mark_stmt_necessary (stmt, true);
@@ -692,8 +696,24 @@ eliminate_unnecessary_stmts (void)
 	    }
 	  else
 	    {
-	      tree call = get_call_expr_in (t);
-	      if (call)
+	      tree call;
+
+	      if (TREE_CODE (t) == VAR_DEBUG_VALUE)
+		{
+		  if (something_changed
+		      && TREE_CODE (VAR_DEBUG_VALUE_VALUE (t)) == SSA_NAME)
+		    {
+		      tree def = SSA_NAME_DEF_STMT (VAR_DEBUG_VALUE_VALUE (t));
+
+		      if (!def || !NECESSARY (def) || IS_EMPTY_STMT (def))
+			{
+			  tree note = build_var_debug_value
+			    (VAR_DEBUG_VALUE_VAR (t), VAR_DEBUG_VALUE_NOVALUE);
+			  bsi_replace (&i, note, false);
+			}
+		    }
+		}
+	      else if ((call = get_call_expr_in (t)))
 		{
 		  tree name;
 
Index: gcc/tree-ssa-propagate.c
===================================================================
--- gcc/tree-ssa-propagate.c.orig	2007-07-11 02:36:55.000000000 -0300
+++ gcc/tree-ssa-propagate.c	2007-07-11 02:43:05.000000000 -0300
@@ -558,6 +558,9 @@ get_rhs (tree stmt)
       else
 	return stmt;
 
+    case VAR_DEBUG_VALUE:
+      return VAR_DEBUG_VALUE_VALUE (stmt);
+
     case COND_EXPR:
       return COND_EXPR_COND (stmt);
     case SWITCH_EXPR:
Index: gcc/tree-ssa.c
===================================================================
--- gcc/tree-ssa.c.orig	2007-07-11 02:36:55.000000000 -0300
+++ gcc/tree-ssa.c	2007-07-11 03:40:55.000000000 -0300
@@ -1,5 +1,5 @@
 /* Miscellaneous SSA utility functions.
-   Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -700,6 +700,9 @@ verify_ssa (bool check_modified_stmt)
 		  goto err;
 		}
 	    }
+	  else if (TREE_CODE (stmt) == VAR_DEBUG_VALUE
+		   && VAR_DEBUG_VALUE_VALUE (stmt) == VAR_DEBUG_VALUE_NOVALUE)
+	    continue;
 
 	  FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_ALL_VIRTUALS)
 	    {
@@ -1312,6 +1315,10 @@ execute_early_warn_uninitialized (void)
     for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
       {
 	tree context = bsi_stmt (bsi);
+
+	if (TREE_CODE (context) == VAR_DEBUG_VALUE)
+	  continue;
+
 	walk_tree (bsi_stmt_ptr (bsi), warn_uninitialized_var,
 		   context, NULL);
       }
Index: gcc/tree-ssa-live.c
===================================================================
--- gcc/tree-ssa-live.c.orig	2007-07-11 02:57:07.000000000 -0300
+++ gcc/tree-ssa-live.c	2007-07-11 02:57:23.000000000 -0300
@@ -1,5 +1,5 @@
 /* Liveness for SSA trees.
-   Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
    Contributed by Andrew MacLeod <amacleod@redhat.com>
 
 This file is part of GCC.
@@ -464,7 +464,8 @@ remove_unused_locals (void)
 
       /* Walk the statements.  */
       for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
-	mark_all_vars_used (bsi_stmt_ptr (bsi));
+	if (TREE_CODE (bsi_stmt (bsi)) != VAR_DEBUG_VALUE)
+	  mark_all_vars_used (bsi_stmt_ptr (bsi));
 
       for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
         {
-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
FSF Latin America Board Member         http://www.fsfla.org/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

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