tree-vrp.c (extract_range_from_multiplicative_op): Remove overflow wraps argument.
* 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
This commit is contained in:
parent
fa6b20f32c
commit
e8f1d5cb7c
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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 ÷nd_min, const wide_int ÷nd_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
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user