tree-vrp.c (set_and_canonicalize_value_range): Use canonical predicates to set VR_UND...
authorRichard Guenther <rguenther@suse.de>
Fri, 15 Jun 2012 13:38:17 +0000 (13:38 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 15 Jun 2012 13:38:17 +0000 (13:38 +0000)
2012-06-15  Richard Guenther  <rguenther@suse.de>

* tree-vrp.c (set_and_canonicalize_value_range): Use canonical
predicates to set VR_UNDEFINED and VR_VARYING.  Drop a case
we assert for in set_value_range to VR_VARYING.

From-SVN: r188663

gcc/ChangeLog
gcc/tree-vrp.c

index 452ed40a0d7483aa32c8f9f85726bc844077d143..e9f1890dea46bc323d255ccbedd2a1bb171ebb57 100644 (file)
@@ -1,3 +1,9 @@
+2012-06-15  Richard Guenther  <rguenther@suse.de>
+
+       * tree-vrp.c (set_and_canonicalize_value_range): Use canonical
+       predicates to set VR_UNDEFINED and VR_VARYING.  Drop a case
+       we assert for in set_value_range to VR_VARYING.
+
 2012-06-15  Richard Earnshaw  <rearnsha@arm.com>
 
        * arm.md (addsf3, adddf3): Use s_register_operand.
index c4ecd6cdd237f9dcbba05520d7e39acc1338b0d4..630118b04bf185873519446603d2d48863972300 100644 (file)
@@ -386,6 +386,18 @@ nonnull_arg_p (const_tree arg)
 }
 
 
+/* Set value range VR to VR_UNDEFINED.  */
+
+static inline void
+set_value_range_to_undefined (value_range_t *vr)
+{
+  vr->type = VR_UNDEFINED;
+  vr->min = vr->max = NULL_TREE;
+  if (vr->equiv)
+    bitmap_clear (vr->equiv);
+}
+
+
 /* Set value range VR to VR_VARYING.  */
 
 static inline void
@@ -463,10 +475,20 @@ static void
 set_and_canonicalize_value_range (value_range_t *vr, enum value_range_type t,
                                  tree min, tree max, bitmap equiv)
 {
-  /* Nothing to canonicalize for symbolic or unknown or varying ranges.  */
-  if ((t != VR_RANGE
-       && t != VR_ANTI_RANGE)
-      || TREE_CODE (min) != INTEGER_CST
+  /* Use the canonical setters for VR_UNDEFINED and VR_VARYING.  */
+  if (t == VR_UNDEFINED)
+    {
+      set_value_range_to_undefined (vr);
+      return;
+    }
+  else if (t == VR_VARYING)
+    {
+      set_value_range_to_varying (vr);
+      return;
+    }
+
+  /* Nothing to canonicalize for symbolic ranges.  */
+  if (TREE_CODE (min) != INTEGER_CST
       || TREE_CODE (max) != INTEGER_CST)
     {
       set_value_range (vr, t, min, max, equiv);
@@ -502,7 +524,8 @@ set_and_canonicalize_value_range (value_range_t *vr, enum value_range_type t,
 
       if (is_min && is_max)
        {
-         /* We cannot deal with empty ranges, drop to varying.  */
+         /* We cannot deal with empty ranges, drop to varying.
+            ???  This could be VR_UNDEFINED instead.  */
          set_value_range_to_varying (vr);
          return;
        }
@@ -525,6 +548,15 @@ set_and_canonicalize_value_range (value_range_t *vr, enum value_range_type t,
         }
     }
 
+  /* Drop [-INF(OVF), +INF(OVF)] to varying.  */
+  if (needs_overflow_infinity (TREE_TYPE (min))
+      && is_overflow_infinity (min)
+      && is_overflow_infinity (max))
+    {
+      set_value_range_to_varying (vr);
+      return;
+    }
+
   set_value_range (vr, t, min, max, equiv);
 }
 
@@ -608,18 +640,6 @@ set_value_range_to_truthvalue (value_range_t *vr, tree type)
 }
 
 
-/* Set value range VR to VR_UNDEFINED.  */
-
-static inline void
-set_value_range_to_undefined (value_range_t *vr)
-{
-  vr->type = VR_UNDEFINED;
-  vr->min = vr->max = NULL_TREE;
-  if (vr->equiv)
-    bitmap_clear (vr->equiv);
-}
-
-
 /* If abs (min) < abs (max), set VR to [-max, max], if
    abs (min) >= abs (max), set VR to [-min, min].  */