tree-vrp.c (extract_range_from_multiplicative_op): Remove overflow wraps argument.
authorAldy Hernandez <aldyh@redhat.com>
Wed, 17 Oct 2018 12:32:08 +0000 (12:32 +0000)
committerAldy Hernandez <aldyh@gcc.gnu.org>
Wed, 17 Oct 2018 12:32:08 +0000 (12:32 +0000)
        * tree-vrp.c (extract_range_from_multiplicative_op): Remove
overflow wraps argument.
        (extract_range_from_binary_expr_1): Do not pass overflow wraps to
wide_int_range_multiplicative_op.
        * wide-int-range.cc (wide_int_range_mult_wrapping): Remove
overflow wraps argument.
        (wide_int_range_multiplicative_op): Same.
        (wide_int_range_lshift): Same.
        (wide_int_range_div): Same.
        * wide-int-range.h (wide_int_range_multiplicative_op): Same.
        (wide_int_range_lshift): Same.
        (wide_int_range_div): Same.

From-SVN: r265238

gcc/ChangeLog
gcc/tree-vrp.c
gcc/wide-int-range.cc
gcc/wide-int-range.h

index 4768b9635f8538c931d7db8fe7e2207a3b88db1b..6cfaac1690d9b232d946fb3989f7f91a3d87f913 100644 (file)
@@ -1,3 +1,18 @@
+2018-10-17  Aldy Hernandez  <aldyh@redhat.com>
+
+        * tree-vrp.c (extract_range_from_multiplicative_op): Remove
+       overflow wraps argument.
+        (extract_range_from_binary_expr_1): Do not pass overflow wraps to
+       wide_int_range_multiplicative_op.
+        * wide-int-range.cc (wide_int_range_mult_wrapping): Remove
+       overflow wraps argument.
+        (wide_int_range_multiplicative_op): Same.
+        (wide_int_range_lshift): Same.
+        (wide_int_range_div): Same.
+        * wide-int-range.h (wide_int_range_multiplicative_op): Same.
+        (wide_int_range_lshift): Same.
+        (wide_int_range_div): Same.
+
 2018-10-17  Aldy Hernandez  <aldyh@redhat.com>
 
        * wide-int-range.h (wide_int_range_shift_undefined_p): Adjust to
index c519613bb28308e9e6ef2256c315bb9706889f1b..0a42da7005e1832b6561a7eeea1675234bf53e67 100644 (file)
@@ -1003,13 +1003,12 @@ extract_range_from_multiplicative_op (value_range *vr,
   wide_int vr1_lb = wi::to_wide (vr1->min);
   wide_int vr1_ub = wi::to_wide (vr1->max);
   bool overflow_undefined = TYPE_OVERFLOW_UNDEFINED (type);
-  bool overflow_wraps = TYPE_OVERFLOW_WRAPS (type);
   unsigned prec = TYPE_PRECISION (type);
 
   if (wide_int_range_multiplicative_op (res_lb, res_ub,
-                                        code, TYPE_SIGN (type), prec,
-                                        vr0_lb, vr0_ub, vr1_lb, vr1_ub,
-                                        overflow_undefined, overflow_wraps))
+                                       code, TYPE_SIGN (type), prec,
+                                       vr0_lb, vr0_ub, vr1_lb, vr1_ub,
+                                       overflow_undefined))
     set_and_canonicalize_value_range (vr, VR_RANGE,
                                      wide_int_to_tree (type, res_lb),
                                      wide_int_to_tree (type, res_ub), NULL);
@@ -1549,8 +1548,7 @@ extract_range_from_binary_expr_1 (value_range *vr,
                                         wi::to_wide (vr0.max),
                                         wi::to_wide (vr1.min),
                                         wi::to_wide (vr1.max),
-                                        TYPE_OVERFLOW_UNDEFINED (expr_type),
-                                        TYPE_OVERFLOW_WRAPS (expr_type)))
+                                        TYPE_OVERFLOW_UNDEFINED (expr_type)))
                {
                  min = wide_int_to_tree (expr_type, res_lb);
                  max = wide_int_to_tree (expr_type, res_ub);
@@ -1595,7 +1593,6 @@ extract_range_from_binary_expr_1 (value_range *vr,
                               dividend_min, dividend_max,
                               divisor_min, divisor_max,
                               TYPE_OVERFLOW_UNDEFINED (expr_type),
-                              TYPE_OVERFLOW_WRAPS (expr_type),
                               extra_range_p, extra_min, extra_max))
        {
          set_value_range_to_varying (vr);
index a85fe9f9ad70fe631d52458a1b1fa2ee7a49f211..8978b5aecfdf24f09e8f3e969d0a3f6dbfd563f3 100644 (file)
@@ -268,7 +268,7 @@ wide_int_range_mult_wrapping (wide_int &res_lb,
 
    Return TRUE if we were able to perform the operation.
 
-   NOTE: If code is MULT_EXPR and TYPE_OVERFLOW_WRAPS, the resulting
+   NOTE: If code is MULT_EXPR and !TYPE_OVERFLOW_UNDEFINED, the resulting
    range must be canonicalized by the caller because its components
    may be swapped.  */
 
@@ -281,8 +281,7 @@ wide_int_range_multiplicative_op (wide_int &res_lb, wide_int &res_ub,
                                  const wide_int &vr0_ub,
                                  const wide_int &vr1_lb,
                                  const wide_int &vr1_ub,
-                                 bool overflow_undefined,
-                                 bool overflow_wraps)
+                                 bool overflow_undefined)
 {
   /* Multiplications, divisions and shifts are a bit tricky to handle,
      depending on the mix of signs we have in the two ranges, we
@@ -296,7 +295,7 @@ wide_int_range_multiplicative_op (wide_int &res_lb, wide_int &res_ub,
      (MIN0 OP MIN1, MIN0 OP MAX1, MAX0 OP MIN1 and MAX0 OP MAX0 OP
      MAX1) and then figure the smallest and largest values to form
      the new range.  */
-  if (code == MULT_EXPR && overflow_wraps)
+  if (code == MULT_EXPR && !overflow_undefined)
     return wide_int_range_mult_wrapping (res_lb, res_ub,
                                         sign, prec,
                                         vr0_lb, vr0_ub, vr1_lb, vr1_ub);
@@ -320,7 +319,7 @@ wide_int_range_lshift (wide_int &res_lb, wide_int &res_ub,
                       signop sign, unsigned prec,
                       const wide_int &vr0_lb, const wide_int &vr0_ub,
                       const wide_int &vr1_lb, const wide_int &vr1_ub,
-                      bool overflow_undefined, bool overflow_wraps)
+                      bool overflow_undefined)
 {
   /* Transform left shifts by constants into multiplies.  */
   if (wi::eq_p (vr1_lb, vr1_ub))
@@ -330,8 +329,7 @@ wide_int_range_lshift (wide_int &res_lb, wide_int &res_ub,
       return wide_int_range_multiplicative_op (res_lb, res_ub,
                                               MULT_EXPR, sign, prec,
                                               vr0_lb, vr0_ub, tmp, tmp,
-                                              overflow_undefined,
-                                              /*overflow_wraps=*/true);
+                                              /*overflow_undefined=*/false);
     }
 
   int overflow_pos = prec;
@@ -387,8 +385,7 @@ wide_int_range_lshift (wide_int &res_lb, wide_int &res_ub,
                                             LSHIFT_EXPR, sign, prec,
                                             vr0_lb, vr0_ub,
                                             vr1_lb, vr1_ub,
-                                            overflow_undefined,
-                                            overflow_wraps);
+                                            overflow_undefined);
   return false;
 }
 
@@ -785,7 +782,6 @@ wide_int_range_div (wide_int &wmin, wide_int &wmax,
                    const wide_int &dividend_min, const wide_int &dividend_max,
                    const wide_int &divisor_min, const wide_int &divisor_max,
                    bool overflow_undefined,
-                   bool overflow_wraps,
                    bool &extra_range_p,
                    wide_int &extra_min, wide_int &extra_max)
 {
@@ -796,8 +792,7 @@ wide_int_range_div (wide_int &wmin, wide_int &wmax,
     return wide_int_range_multiplicative_op (wmin, wmax, code, sign, prec,
                                             dividend_min, dividend_max,
                                             divisor_min, divisor_max,
-                                            overflow_undefined,
-                                            overflow_wraps);
+                                            overflow_undefined);
 
   /* If flag_non_call_exceptions, we must not eliminate a division
      by zero.  */
@@ -818,8 +813,7 @@ wide_int_range_div (wide_int &wmin, wide_int &wmax,
                                             code, sign, prec,
                                             dividend_min, dividend_max,
                                             divisor_min, wi::minus_one (prec),
-                                            overflow_undefined,
-                                            overflow_wraps))
+                                            overflow_undefined))
        return false;
       extra_range_p = true;
     }
@@ -831,8 +825,7 @@ wide_int_range_div (wide_int &wmin, wide_int &wmax,
                                             code, sign, prec,
                                             dividend_min, dividend_max,
                                             wi::one (prec), divisor_max,
-                                            overflow_undefined,
-                                            overflow_wraps))
+                                            overflow_undefined))
        return false;
     }
   else
index 0b2dd223987dff235620136746ae91883aa0680c..961d26dbb08cbe3d166202e45bf80dd4f15d88ef 100644 (file)
@@ -42,14 +42,12 @@ extern bool wide_int_range_multiplicative_op (wide_int &res_lb,
                                              const wide_int &vr0_ub,
                                              const wide_int &vr1_lb,
                                              const wide_int &vr1_ub,
-                                             bool overflow_undefined,
-                                             bool overflow_wraps);
+                                             bool overflow_undefined);
 extern bool wide_int_range_lshift (wide_int &res_lb, wide_int &res_ub,
                                   signop sign, unsigned prec,
                                   const wide_int &, const wide_int &,
                                   const wide_int &, const wide_int &,
-                                  bool overflow_undefined,
-                                  bool overflow_wraps);
+                                  bool overflow_undefined);
 extern void wide_int_range_set_zero_nonzero_bits (signop,
                                                  const wide_int &lb,
                                                  const wide_int &ub,
@@ -124,7 +122,6 @@ extern bool wide_int_range_div (wide_int &wmin, wide_int &wmax,
                                const wide_int &divisor_min,
                                const wide_int &divisor_max,
                                bool overflow_undefined,
-                               bool overflow_wraps,
                                bool &extra_range_p,
                                wide_int &extra_min, wide_int &extra_max);