]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* tree-vrp.c (vrp_shift_undefined_p): Remove.
authoraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 12 Sep 2018 07:04:19 +0000 (07:04 +0000)
committeraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 12 Sep 2018 07:04:19 +0000 (07:04 +0000)
(extract_range_from_binary_expr_1: Call
wide_int_range_shift_undefined_p instead of vrp_shift_undefined_p.
* wide-int-range.h (wide_int_range_shift_undefined_p): Do not
depend on sign.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@264228 138bc75d-0d04-0410-961f-82ee72b054a4

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

index f5468ca65c1a816ba8ec95e68ce21c727db7c66e..e3ed7071edc855cbf9cde73fef2216ddc7d977db 100644 (file)
@@ -1,3 +1,11 @@
+2018-09-12  Aldy Hernandez  <aldyh@redhat.com>
+
+       * tree-vrp.c (vrp_shift_undefined_p): Remove.
+       (extract_range_from_binary_expr_1: Call
+       wide_int_range_shift_undefined_p instead of vrp_shift_undefined_p.
+       * wide-int-range.h (wide_int_range_shift_undefined_p): Do not
+       depend on sign.
+
 2018-09-12  Aldy Hernandez  <aldyh@redhat.com>
 
        * gimple-ssa-warn-alloca.c
index a82cf3e36c1373959f3efbbbcf6e3a17dcb43e7d..d26011a9e66394456cd45ae88f5ff54d6a0c46d1 100644 (file)
@@ -1018,17 +1018,6 @@ extract_range_into_wide_ints (const value_range *vr,
     }
 }
 
-/* Value range wrapper for wide_int_range_shift_undefined_p.  */
-
-static inline bool
-vrp_shift_undefined_p (const value_range &shifter, unsigned prec)
-{
-  tree type = TREE_TYPE (shifter.min);
-  return wide_int_range_shift_undefined_p (TYPE_SIGN (type), prec,
-                                          wi::to_wide (shifter.min),
-                                          wi::to_wide (shifter.max));
-}
-
 /* Value range wrapper for wide_int_range_multiplicative_op:
 
      *VR = *VR0 .CODE. *VR1.  */
@@ -1549,7 +1538,9 @@ extract_range_from_binary_expr_1 (value_range *vr,
           || code == LSHIFT_EXPR)
     {
       if (range_int_cst_p (&vr1)
-         && !vrp_shift_undefined_p (vr1, prec))
+         && !wide_int_range_shift_undefined_p (prec,
+                                               wi::to_wide (vr1.min),
+                                               wi::to_wide (vr1.max)))
        {
          if (code == RSHIFT_EXPR)
            {
index 589fdea4df696322e05123398f06b63e27edc538..e9ee418e5b2789b30baf14e7e96b2a5621c7b088 100644 (file)
@@ -131,7 +131,7 @@ extern bool wide_int_range_div (wide_int &wmin, wide_int &wmax,
 /* Return TRUE if shifting by range [MIN, MAX] is undefined behavior.  */
 
 inline bool
-wide_int_range_shift_undefined_p (signop sign, unsigned prec,
+wide_int_range_shift_undefined_p (unsigned prec,
                                  const wide_int &min, const wide_int &max)
 {
   /* ?? Note: The original comment said this only applied to
@@ -142,7 +142,7 @@ wide_int_range_shift_undefined_p (signop sign, unsigned prec,
      behavior from the shift operation.  We cannot even trust
      SHIFT_COUNT_TRUNCATED at this stage, because that applies to rtl
      shifts, and the operation at the tree level may be widened.  */
-  return wi::lt_p (min, 0, sign) || wi::ge_p (max, prec, sign);
+  return wi::sign_mask (min) || wi::ge_p (max, prec, UNSIGNED);
 }
 
 /* Calculate MIN/MAX_EXPR of two ranges and store the result in [MIN, MAX].  */