[PATCH] Fix bootstrap failure with release checking

Richard Guenther rguenther@suse.de
Fri Oct 12 14:20:00 GMT 2007


due to my tree-ssa-forwprop.c patch.  It also fixes a logical error
I made in restricting the transformations allowed.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to mainline.

Richard.

2007-10-12  Richard Guenther <rguenther@suse.de>

	* tree-ssa-forwprop.c (forward_propagate_into_cond): For
	combining both operands require either both have single uses
	or combining to a constant.

Index: tree-ssa-forwprop.c
===================================================================
*** tree-ssa-forwprop.c	(revision 129260)
--- tree-ssa-forwprop.c	(working copy)
*************** forward_propagate_into_cond (tree cond_e
*** 360,366 ****
      tree tmp = NULL_TREE;
      tree cond = COND_EXPR_COND (cond_expr);
      tree name, def_stmt, rhs0 = NULL_TREE, rhs1 = NULL_TREE;
!     bool single_use_p;
  
      /* We can do tree combining on SSA_NAME and comparison expressions.  */
      if (COMPARISON_CLASS_P (cond)
--- 360,366 ----
      tree tmp = NULL_TREE;
      tree cond = COND_EXPR_COND (cond_expr);
      tree name, def_stmt, rhs0 = NULL_TREE, rhs1 = NULL_TREE;
!     bool single_use0_p = false, single_use1_p = false;
  
      /* We can do tree combining on SSA_NAME and comparison expressions.  */
      if (COMPARISON_CLASS_P (cond)
*************** forward_propagate_into_cond (tree cond_e
*** 369,375 ****
  	/* For comparisons use the first operand, that is likely to
  	   simplify comparisons against constants.  */
  	name = TREE_OPERAND (cond, 0);
! 	def_stmt = get_prop_source_stmt (name, false, &single_use_p);
  	if (def_stmt != NULL_TREE
  	    && can_propagate_from (def_stmt))
  	  {
--- 369,375 ----
  	/* For comparisons use the first operand, that is likely to
  	   simplify comparisons against constants.  */
  	name = TREE_OPERAND (cond, 0);
! 	def_stmt = get_prop_source_stmt (name, false, &single_use0_p);
  	if (def_stmt != NULL_TREE
  	    && can_propagate_from (def_stmt))
  	  {
*************** forward_propagate_into_cond (tree cond_e
*** 377,383 ****
  	    rhs0 = GIMPLE_STMT_OPERAND (def_stmt, 1);
  	    tmp = combine_cond_expr_cond (TREE_CODE (cond), boolean_type_node,
  				          fold_convert (TREE_TYPE (op1), rhs0),
! 				          op1, !single_use_p);
  	  }
  	/* If that wasn't successful, try the second operand.  */
  	if (tmp == NULL_TREE
--- 377,383 ----
  	    rhs0 = GIMPLE_STMT_OPERAND (def_stmt, 1);
  	    tmp = combine_cond_expr_cond (TREE_CODE (cond), boolean_type_node,
  				          fold_convert (TREE_TYPE (op1), rhs0),
! 				          op1, !single_use0_p);
  	  }
  	/* If that wasn't successful, try the second operand.  */
  	if (tmp == NULL_TREE
*************** forward_propagate_into_cond (tree cond_e
*** 385,391 ****
  	  {
  	    tree op0 = TREE_OPERAND (cond, 0);
  	    name = TREE_OPERAND (cond, 1);
! 	    def_stmt = get_prop_source_stmt (name, false, &single_use_p);
  	    if (def_stmt == NULL_TREE
  	        || !can_propagate_from (def_stmt))
  	      return did_something;
--- 385,391 ----
  	  {
  	    tree op0 = TREE_OPERAND (cond, 0);
  	    name = TREE_OPERAND (cond, 1);
! 	    def_stmt = get_prop_source_stmt (name, false, &single_use1_p);
  	    if (def_stmt == NULL_TREE
  	        || !can_propagate_from (def_stmt))
  	      return did_something;
*************** forward_propagate_into_cond (tree cond_e
*** 394,400 ****
  	    tmp = combine_cond_expr_cond (TREE_CODE (cond), boolean_type_node,
  					  op0,
  				          fold_convert (TREE_TYPE (op0), rhs1),
! 					  !single_use_p);
  	  }
  	/* If that wasn't successful either, try both operands.  */
  	if (tmp == NULL_TREE
--- 394,400 ----
  	    tmp = combine_cond_expr_cond (TREE_CODE (cond), boolean_type_node,
  					  op0,
  				          fold_convert (TREE_TYPE (op0), rhs1),
! 					  !single_use1_p);
  	  }
  	/* If that wasn't successful either, try both operands.  */
  	if (tmp == NULL_TREE
*************** forward_propagate_into_cond (tree cond_e
*** 403,409 ****
  	  tmp = combine_cond_expr_cond (TREE_CODE (cond), boolean_type_node,
  					rhs0,
  				        fold_convert (TREE_TYPE (rhs0), rhs1),
! 					!single_use_p);
        }
      else if (TREE_CODE (cond) == SSA_NAME)
        {
--- 403,409 ----
  	  tmp = combine_cond_expr_cond (TREE_CODE (cond), boolean_type_node,
  					rhs0,
  				        fold_convert (TREE_TYPE (rhs0), rhs1),
! 					!(single_use0_p && single_use1_p));
        }
      else if (TREE_CODE (cond) == SSA_NAME)
        {



More information about the Gcc-patches mailing list