On Sat, 11 Nov 2017, Jakub Jelinek wrote:

On Sat, Nov 11, 2017 at 11:03:06PM +0100, Marc Glisse wrote:
--- gcc/tree-vrp.c      (revision 254629)
+++ gcc/tree-vrp.c      (working copy)
@@ -2086,20 +2086,38 @@ extract_range_from_binary_expr_1 (value_
       else
        set_value_range_to_varying (vr);

       return;
     }

   /* For integer ranges, apply the operation to each end of the
      range and see what we end up with.  */
   if (code == PLUS_EXPR || code == MINUS_EXPR)
     {
+      /* If one argument is varying, we can sometimes still deduce a
+        range for the output: any + [3, +INF] is in [MIN+3, +INF].  */
+      if (TYPE_OVERFLOW_UNDEFINED (expr_type))
+       {
+         if(vr0.type == VR_VARYING && vr1.type == VR_RANGE)
+           {
+             vr0.type = type = VR_RANGE;
+             vr0.min = vrp_val_min (expr_type);
+             vr0.max = vrp_val_max (expr_type);
+           }
+         if(vr1.type == VR_VARYING && vr0.type == VR_RANGE)

Missing space before ( in 2 places.

Thanks.

Shouldn't this second if be actually else if?

I don't think it matters, since you cannot satisfy both sets of conditions. But you are right that it may be clearer, so I added the "else" locally.

--
Marc Glisse

Reply via email to