From: aldyh Date: Wed, 12 Sep 2018 07:04:19 +0000 (+0000) Subject: * tree-vrp.c (vrp_shift_undefined_p): Remove. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=175895dc1ca8825beec3e571df7cce12f780de33;p=thirdparty%2Fgcc.git * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@264228 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f5468ca65c1a..e3ed7071edc8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2018-09-12 Aldy Hernandez + + * 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 * gimple-ssa-warn-alloca.c diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index a82cf3e36c13..d26011a9e663 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -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) { diff --git a/gcc/wide-int-range.h b/gcc/wide-int-range.h index 589fdea4df69..e9ee418e5b27 100644 --- a/gcc/wide-int-range.h +++ b/gcc/wide-int-range.h @@ -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]. */