[patch] tree-vrp.c: A minor clean up.

Kazu Hirata kazu@codesourcery.com
Thu Dec 22 01:08:00 GMT 2005


Hi,

Attached is a patch to do a minor clean up for
extract_range_from_binary_expr in tree-vrp.c.

In extract_range_from_binary_expr, vr0.type is used for two purposes.
One is to hold the value range type of vr0.  The other is to hold the
type of the resulting value range.

Since this dual purpose variable is confusing, the patch introduces a
new variable called type, and use it to construct the resulting value
range type.

Tested on x86_64-pc-linux-gnu.  OK to apply?

Kazu Hirata

2005-12-22  Kazu Hirata  <kazu@codesourcery.com>

	* tree-vrp.c (extract_range_from_binary_expr): Clean up uses
	of vr0.type.

Index: tree-vrp.c
===================================================================
--- tree-vrp.c	(revision 108905)
+++ tree-vrp.c	(working copy)
@@ -1167,6 +1167,7 @@ static void
 extract_range_from_binary_expr (value_range_t *vr, tree expr)
 {
   enum tree_code code = TREE_CODE (expr);
+  enum value_range_type type;
   tree op0, op1, min, max;
   int cmp;
   value_range_t vr0 = { VR_UNDEFINED, NULL_TREE, NULL_TREE, NULL };
@@ -1220,6 +1221,9 @@ extract_range_from_binary_expr (value_ra
       return;
     }
 
+  /* The type of the resulting value range defaults to VR0.TYPE.  */
+  type = vr0.type;
+
   /* Refuse to operate on VARYING ranges, ranges of different kinds
      and symbolic ranges.  As an exception, we allow BIT_AND_EXPR
      because we may be able to derive a useful range even if one of
@@ -1425,7 +1429,7 @@ extract_range_from_binary_expr (value_ra
 	  && tree_expr_nonnegative_p (vr1.max)
 	  && TREE_CODE (vr1.max) == INTEGER_CST)
 	{
-	  vr0.type = VR_RANGE;
+	  type = VR_RANGE;
 	  min = fold_convert (TREE_TYPE (expr), integer_zero_node);
 	  max = vr1.max;
 	}
@@ -1455,7 +1459,7 @@ extract_range_from_binary_expr (value_ra
       set_value_range_to_varying (vr);
     }
   else
-    set_value_range (vr, vr0.type, min, max, NULL);
+    set_value_range (vr, type, min, max, NULL);
 }
 
 



More information about the Gcc-patches mailing list