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]

[tree-ssa] DOM buglet fix and others


These are some not-so-unrelated fixes for bugs that got exposed with the
more aggressive must-alias changes I'm working on.

The main fix is in the DOM pass.  We were not always calling
propagate_copy when doing copy propagation.  This was causing failures
in libstdc++ when copy propagating pointers and not updating their alias
tags.  We now call a new function propagate_value that knows what to do
with both constants and copies.

The other changes are to squash warnings for uninitialized variables
that we are now able to detect better.  Including one that was committed
and later reverted last week.

Bootstrapped and tested x86, amd64 and ia64.


Diego.


	* ifcvt.c (dead_or_predicable): Initialize local variable
	'earliest'.
	* tree-cfg.c (verify_stmt): Fix typo.
	* tree-ssa-dom.c (propagate_value): New local function.
	(cprop_into_stmt): Call it.
	(cprop_into_phis): Call it.
	(eliminate_redundant_computations): Call it.

java/ChangeLog.tree-ssa:

2003-12-06  Jan Hubicka  <jh@suse.de>

	* parse.y (resolve_field_access): Initialize local variable
	'decl'.

Index: ifcvt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ifcvt.c,v
retrieving revision 1.95.2.22
diff -d -c -p -r1.95.2.22 ifcvt.c
*** ifcvt.c	1 Dec 2003 19:38:37 -0000	1.95.2.22
--- ifcvt.c	11 Dec 2003 01:17:38 -0000
*************** static int
*** 2926,2932 ****
  dead_or_predicable (basic_block test_bb, basic_block merge_bb,
  		    basic_block other_bb, basic_block new_dest, int reversep)
  {
!   rtx head, end, jump, earliest, old_dest, new_label = NULL_RTX;
  
    jump = test_bb->end;
  
--- 2926,2932 ----
  dead_or_predicable (basic_block test_bb, basic_block merge_bb,
  		    basic_block other_bb, basic_block new_dest, int reversep)
  {
!   rtx head, end, jump, earliest = NULL_RTX, old_dest, new_label = NULL_RTX;
  
    jump = test_bb->end;
  
Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-cfg.c,v
retrieving revision 1.1.4.234
diff -d -c -p -r1.1.4.234 tree-cfg.c
*** tree-cfg.c	8 Dec 2003 13:52:59 -0000	1.1.4.234
--- tree-cfg.c	11 Dec 2003 01:17:38 -0000
*************** verify_stmt (tree stmt)
*** 2795,2801 ****
    addr = walk_tree (&stmt, verify_addr_expr, NULL, NULL);
    if (addr)
      {
!       error ("Address taken, but ADDRESABLE bit not set");
        debug_generic_stmt (addr);
        return true;
      }
--- 2795,2801 ----
    addr = walk_tree (&stmt, verify_addr_expr, NULL, NULL);
    if (addr)
      {
!       error ("Address taken, but ADDRESSABLE bit not set");
        debug_generic_stmt (addr);
        return true;
      }
Index: tree-ssa-dom.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-dom.c,v
retrieving revision 1.1.2.92
diff -d -c -p -r1.1.2.92 tree-ssa-dom.c
*** tree-ssa-dom.c	5 Dec 2003 23:02:24 -0000	1.1.2.92
--- tree-ssa-dom.c	11 Dec 2003 01:17:38 -0000
*************** static void tree_ssa_dominator_optimize_
*** 242,247 ****
--- 242,261 ----
  					   timevar_id_t);
  static void thread_jumps_walk_stmts (struct dom_walk_data *, basic_block, tree);
  
+ 
+ /* Propagate the value VAL (assumed to be a constant or another SSA_NAME)
+    into the operand pointed by OP_P.  */
+ 
+ static inline void
+ propagate_value (tree *op_p, tree val)
+ {
+   if (TREE_CODE (*op_p) == SSA_NAME
+       && TREE_CODE (val) == SSA_NAME)
+     propagate_copy (op_p, val);
+   else
+     *op_p = val;
+ }
+ 
  /* Return the value associated with variable VAR in TABLE.  */
  
  static inline tree
*************** cprop_into_stmt (tree stmt)
*** 1922,1931 ****
  		    && is_gimple_min_invariant (val)))
  	      may_have_exposed_new_symbols = true;
  
! 	    if (TREE_CODE (val) == SSA_NAME)
! 	      propagate_copy (op_p, val);
! 	    else
! 	      *op_p = val;
  
  	    /* And note that we modified this statement.  This is now
  	       safe, even if we changed virtual operands since we will
--- 1936,1942 ----
  		    && is_gimple_min_invariant (val)))
  	      may_have_exposed_new_symbols = true;
  
! 	    propagate_value (op_p, val);
  
  	    /* And note that we modified this statement.  This is now
  	       safe, even if we changed virtual operands since we will
*************** cprop_into_phis (struct dom_walk_data *w
*** 2012,2020 ****
  	     ORIG_P with its value in our constant/copy table.  */
  	  new = get_value_for (*orig_p, const_and_copies);
  	  if (new
! 	      && (TREE_CODE (new) == SSA_NAME || is_gimple_min_invariant (new))
  	      && may_propagate_copy (*orig_p, new))
! 	    *orig_p = new;
  	}
      }
  }
--- 2023,2032 ----
  	     ORIG_P with its value in our constant/copy table.  */
  	  new = get_value_for (*orig_p, const_and_copies);
  	  if (new
! 	      && (TREE_CODE (new) == SSA_NAME
! 		  || is_gimple_min_invariant (new))
  	      && may_propagate_copy (*orig_p, new))
! 	    propagate_value (orig_p, new);
  	}
      }
  }
*************** eliminate_redundant_computations (struct
*** 2113,2119 ****
  	      && is_gimple_min_invariant (cached_lhs)))
  	retval = true;
  
!       *expr_p = cached_lhs;
        ann->modified = 1;
      }
    return retval;
--- 2125,2131 ----
  	      && is_gimple_min_invariant (cached_lhs)))
  	retval = true;
  
!       propagate_value (expr_p, cached_lhs);
        ann->modified = 1;
      }
    return retval;
Index: java/parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.387.2.44
diff -d -c -p -r1.387.2.44 parse.y
*** java/parse.y	6 Dec 2003 14:46:35 -0000	1.387.2.44
--- java/parse.y	11 Dec 2003 01:17:42 -0000
*************** resolve_field_access (tree qual_wfl, tre
*** 9360,9365 ****
--- 9360,9366 ----
    tree field_ref;
    tree decl = NULL, where_found, type_found;
  
+   decl = NULL_TREE;
    if (resolve_qualified_expression_name (qual_wfl, &decl,
  					 &where_found, &type_found))
      return error_mark_node;



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