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]

[PATCH] CSE some calls to compare_values


Bootstrapped and tested on x86_64-unknown-linux-gnu.

Applied to mainline.
Richard.

2007-01-07 Richard Guenther <rguenther@suse.de>

       * tree-vrp.c (extract_range_from_assert): CSE calls to
       compare_values where possible.
       (extract_range_from_unary_expr): Likewise.
2007-01-07  Richard Guenther  <rguenther@suse.de>

	* tree-vrp.c (extract_range_from_assert): CSE calls to
	compare_values where possible.
	(extract_range_from_unary_expr): Likewise.

Index: tree-vrp.c
===================================================================
*** tree-vrp.c	(revision 120522)
--- tree-vrp.c	(working copy)
*************** extract_range_from_assert (value_range_t
*** 1066,1071 ****
--- 1104,1110 ----
        else
  	{
  	  tree min, max, anti_min, anti_max, real_min, real_max;
+ 	  int cmp;
  
  	  /* We want to compute the logical AND of the two ranges;
  	     there are three cases to consider.
*************** extract_range_from_assert (value_range_t
*** 1130,1137 ****
  	  /* Case 3a, the anti-range extends into the low
  	     part of the real range.  Thus creating a new
  	     low for the real range.  */
! 	  else if ((compare_values (anti_max, real_min) == 1
! 		    || compare_values (anti_max, real_min) == 0)
  		   && compare_values (anti_max, real_max) == -1)
  	    {
  	      min = fold_build2 (PLUS_EXPR, TREE_TYPE (var_vr->min),
--- 1169,1176 ----
  	  /* Case 3a, the anti-range extends into the low
  	     part of the real range.  Thus creating a new
  	     low for the real range.  */
! 	  else if (((cmp = compare_values (anti_max, real_min)) == 1
! 		    || cmp == 0)
  		   && compare_values (anti_max, real_max) == -1)
  	    {
  	      min = fold_build2 (PLUS_EXPR, TREE_TYPE (var_vr->min),
*************** extract_range_from_assert (value_range_t
*** 1144,1151 ****
  	     part of the real range.  Thus creating a new
  	     higher for the real range.  */
  	  else if (compare_values (anti_min, real_min) == 1
! 		   && (compare_values (anti_min, real_max) == -1
! 		       || compare_values (anti_min, real_max) == 0))
  	    {
  	      max = fold_build2 (MINUS_EXPR, TREE_TYPE (var_vr->min),
  				 anti_min,
--- 1183,1190 ----
  	     part of the real range.  Thus creating a new
  	     higher for the real range.  */
  	  else if (compare_values (anti_min, real_min) == 1
! 		   && ((cmp = compare_values (anti_min, real_max)) == -1
! 		       || cmp == 0))
  	    {
  	      max = fold_build2 (MINUS_EXPR, TREE_TYPE (var_vr->min),
  				 anti_min,
*************** extract_range_from_unary_expr (value_ran
*** 1734,1741 ****
  	      && is_gimple_val (new_max)
  	      && tree_int_cst_equal (new_min, orig_min)
  	      && tree_int_cst_equal (new_max, orig_max)
! 	      && compare_values (new_min, new_max) <= 0
! 	      && compare_values (new_min, new_max) >= -1)
  	    {
  	      set_value_range (vr, VR_RANGE, new_min, new_max, vr->equiv);
  	      return;
--- 1855,1862 ----
  	      && is_gimple_val (new_max)
  	      && tree_int_cst_equal (new_min, orig_min)
  	      && tree_int_cst_equal (new_max, orig_max)
! 	      && (cmp = compare_values (new_min, new_max)) <= 0
! 	      && cmp >= -1)
  	    {
  	      set_value_range (vr, VR_RANGE, new_min, new_max, vr->equiv);
  	      return;


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