tree-vrp.c (vrp_shift_undefined_p): Remove.

* 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.

From-SVN: r264228
This commit is contained in:
Aldy Hernandez 2018-09-12 07:04:19 +00:00 committed by Aldy Hernandez
parent bb753cad99
commit 28aa632320
3 changed files with 13 additions and 14 deletions

View 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

View 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)
{

View 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]. */