aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r--gcc/tree-vrp.c220
1 files changed, 125 insertions, 95 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 3e8be26..2c86b8e 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -1072,7 +1072,8 @@ compare_values_warnv (tree val1, tree val2, bool *strict_overflow_p)
if (!inv2)
inv2 = build_int_cst (TREE_TYPE (val2), 0);
- return wi::cmp (inv1, inv2, TYPE_SIGN (TREE_TYPE (val1)));
+ return wi::cmp (wi::to_wide (inv1), wi::to_wide (inv2),
+ TYPE_SIGN (TREE_TYPE (val1)));
}
const bool cst1 = is_gimple_min_invariant (val1);
@@ -1099,10 +1100,11 @@ compare_values_warnv (tree val1, tree val2, bool *strict_overflow_p)
/* Compute the difference between the constants. If it overflows or
underflows, this means that we can trivially compare the NAME with
it and, consequently, the two values with each other. */
- wide_int diff = wi::sub (cst, inv);
- if (wi::cmp (0, inv, sgn) != wi::cmp (diff, cst, sgn))
+ wide_int diff = wi::to_wide (cst) - wi::to_wide (inv);
+ if (wi::cmp (0, wi::to_wide (inv), sgn)
+ != wi::cmp (diff, wi::to_wide (cst), sgn))
{
- const int res = wi::cmp (cst, inv, sgn);
+ const int res = wi::cmp (wi::to_wide (cst), wi::to_wide (inv), sgn);
return cst1 ? res : -res;
}
@@ -1635,14 +1637,15 @@ vrp_int_const_binop (enum tree_code code, tree val1, tree val2,
/* It's unclear from the C standard whether shifts can overflow.
The following code ignores overflow; perhaps a C standard
interpretation ruling is needed. */
- res = wi::rshift (val1, wval2, sign);
+ res = wi::rshift (wi::to_wide (val1), wval2, sign);
else
- res = wi::lshift (val1, wval2);
+ res = wi::lshift (wi::to_wide (val1), wval2);
break;
}
case MULT_EXPR:
- res = wi::mul (val1, val2, sign, &overflow);
+ res = wi::mul (wi::to_wide (val1),
+ wi::to_wide (val2), sign, &overflow);
break;
case TRUNC_DIV_EXPR:
@@ -1653,7 +1656,8 @@ vrp_int_const_binop (enum tree_code code, tree val1, tree val2,
return res;
}
else
- res = wi::div_trunc (val1, val2, sign, &overflow);
+ res = wi::div_trunc (wi::to_wide (val1),
+ wi::to_wide (val2), sign, &overflow);
break;
case FLOOR_DIV_EXPR:
@@ -1662,7 +1666,8 @@ vrp_int_const_binop (enum tree_code code, tree val1, tree val2,
*overflow_p = true;
return res;
}
- res = wi::div_floor (val1, val2, sign, &overflow);
+ res = wi::div_floor (wi::to_wide (val1),
+ wi::to_wide (val2), sign, &overflow);
break;
case CEIL_DIV_EXPR:
@@ -1671,7 +1676,8 @@ vrp_int_const_binop (enum tree_code code, tree val1, tree val2,
*overflow_p = true;
return res;
}
- res = wi::div_ceil (val1, val2, sign, &overflow);
+ res = wi::div_ceil (wi::to_wide (val1),
+ wi::to_wide (val2), sign, &overflow);
break;
case ROUND_DIV_EXPR:
@@ -1680,7 +1686,8 @@ vrp_int_const_binop (enum tree_code code, tree val1, tree val2,
*overflow_p = 0;
return res;
}
- res = wi::div_round (val1, val2, sign, &overflow);
+ res = wi::div_round (wi::to_wide (val1),
+ wi::to_wide (val2), sign, &overflow);
break;
default:
@@ -1755,15 +1762,15 @@ zero_nonzero_bits_from_vr (const tree expr_type,
if (range_int_cst_singleton_p (vr))
{
- *may_be_nonzero = vr->min;
+ *may_be_nonzero = wi::to_wide (vr->min);
*must_be_nonzero = *may_be_nonzero;
}
else if (tree_int_cst_sgn (vr->min) >= 0
|| tree_int_cst_sgn (vr->max) < 0)
{
- wide_int xor_mask = wi::bit_xor (vr->min, vr->max);
- *may_be_nonzero = wi::bit_or (vr->min, vr->max);
- *must_be_nonzero = wi::bit_and (vr->min, vr->max);
+ wide_int xor_mask = wi::to_wide (vr->min) ^ wi::to_wide (vr->max);
+ *may_be_nonzero = wi::to_wide (vr->min) | wi::to_wide (vr->max);
+ *must_be_nonzero = wi::to_wide (vr->min) & wi::to_wide (vr->max);
if (xor_mask != 0)
{
wide_int mask = wi::mask (wi::floor_log2 (xor_mask), false,
@@ -1801,12 +1808,12 @@ ranges_from_anti_range (value_range *ar,
{
vr0->type = VR_RANGE;
vr0->min = vrp_val_min (type);
- vr0->max = wide_int_to_tree (type, wi::sub (ar->min, 1));
+ vr0->max = wide_int_to_tree (type, wi::to_wide (ar->min) - 1);
}
if (!vrp_val_is_max (ar->max))
{
vr1->type = VR_RANGE;
- vr1->min = wide_int_to_tree (type, wi::add (ar->max, 1));
+ vr1->min = wide_int_to_tree (type, wi::to_wide (ar->max) + 1);
vr1->max = vrp_val_max (type);
}
if (vr0->type == VR_UNDEFINED)
@@ -2171,8 +2178,8 @@ extract_range_from_binary_expr_1 (value_range *vr,
}
else
{
- type_min = vrp_val_min (expr_type);
- type_max = vrp_val_max (expr_type);
+ type_min = wi::to_wide (vrp_val_min (expr_type));
+ type_max = wi::to_wide (vrp_val_max (expr_type));
}
/* Combine the lower bounds, if any. */
@@ -2180,39 +2187,42 @@ extract_range_from_binary_expr_1 (value_range *vr,
{
if (minus_p)
{
- wmin = wi::sub (min_op0, min_op1);
+ wmin = wi::to_wide (min_op0) - wi::to_wide (min_op1);
/* Check for overflow. */
- if (wi::cmp (0, min_op1, sgn)
- != wi::cmp (wmin, min_op0, sgn))
- min_ovf = wi::cmp (min_op0, min_op1, sgn);
+ if (wi::cmp (0, wi::to_wide (min_op1), sgn)
+ != wi::cmp (wmin, wi::to_wide (min_op0), sgn))
+ min_ovf = wi::cmp (wi::to_wide (min_op0),
+ wi::to_wide (min_op1), sgn);
}
else
{
- wmin = wi::add (min_op0, min_op1);
+ wmin = wi::to_wide (min_op0) + wi::to_wide (min_op1);
/* Check for overflow. */
- if (wi::cmp (min_op1, 0, sgn)
- != wi::cmp (wmin, min_op0, sgn))
- min_ovf = wi::cmp (min_op0, wmin, sgn);
+ if (wi::cmp (wi::to_wide (min_op1), 0, sgn)
+ != wi::cmp (wmin, wi::to_wide (min_op0), sgn))
+ min_ovf = wi::cmp (wi::to_wide (min_op0), wmin, sgn);
}
}
else if (min_op0)
- wmin = min_op0;
+ wmin = wi::to_wide (min_op0);
else if (min_op1)
{
if (minus_p)
{
- wmin = wi::neg (min_op1);
+ wmin = -wi::to_wide (min_op1);
/* Check for overflow. */
- if (sgn == SIGNED && wi::neg_p (min_op1) && wi::neg_p (wmin))
+ if (sgn == SIGNED
+ && wi::neg_p (wi::to_wide (min_op1))
+ && wi::neg_p (wmin))
min_ovf = 1;
- else if (sgn == UNSIGNED && wi::ne_p (min_op1, 0))
+ else if (sgn == UNSIGNED && wi::to_wide (min_op1) != 0)
min_ovf = -1;
}
else
- wmin = min_op1;
+ wmin = wi::to_wide (min_op1);
}
else
wmin = wi::shwi (0, prec);
@@ -2222,38 +2232,41 @@ extract_range_from_binary_expr_1 (value_range *vr,
{
if (minus_p)
{
- wmax = wi::sub (max_op0, max_op1);
+ wmax = wi::to_wide (max_op0) - wi::to_wide (max_op1);
/* Check for overflow. */
- if (wi::cmp (0, max_op1, sgn)
- != wi::cmp (wmax, max_op0, sgn))
- max_ovf = wi::cmp (max_op0, max_op1, sgn);
+ if (wi::cmp (0, wi::to_wide (max_op1), sgn)
+ != wi::cmp (wmax, wi::to_wide (max_op0), sgn))
+ max_ovf = wi::cmp (wi::to_wide (max_op0),
+ wi::to_wide (max_op1), sgn);
}
else
{
- wmax = wi::add (max_op0, max_op1);
+ wmax = wi::to_wide (max_op0) + wi::to_wide (max_op1);
- if (wi::cmp (max_op1, 0, sgn)
- != wi::cmp (wmax, max_op0, sgn))
- max_ovf = wi::cmp (max_op0, wmax, sgn);
+ if (wi::cmp (wi::to_wide (max_op1), 0, sgn)
+ != wi::cmp (wmax, wi::to_wide (max_op0), sgn))
+ max_ovf = wi::cmp (wi::to_wide (max_op0), wmax, sgn);
}
}
else if (max_op0)
- wmax = max_op0;
+ wmax = wi::to_wide (max_op0);
else if (max_op1)
{
if (minus_p)
{
- wmax = wi::neg (max_op1);
+ wmax = -wi::to_wide (max_op1);
/* Check for overflow. */
- if (sgn == SIGNED && wi::neg_p (max_op1) && wi::neg_p (wmax))
+ if (sgn == SIGNED
+ && wi::neg_p (wi::to_wide (max_op1))
+ && wi::neg_p (wmax))
max_ovf = 1;
- else if (sgn == UNSIGNED && wi::ne_p (max_op1, 0))
+ else if (sgn == UNSIGNED && wi::to_wide (max_op1) != 0)
max_ovf = -1;
}
else
- wmax = max_op1;
+ wmax = wi::to_wide (max_op1);
}
else
wmax = wi::shwi (0, prec);
@@ -2628,14 +2641,14 @@ extract_range_from_binary_expr_1 (value_range *vr,
{
low_bound = bound;
high_bound = complement;
- if (wi::ltu_p (vr0.max, low_bound))
+ if (wi::ltu_p (wi::to_wide (vr0.max), low_bound))
{
/* [5, 6] << [1, 2] == [10, 24]. */
/* We're shifting out only zeroes, the value increases
monotonically. */
in_bounds = true;
}
- else if (wi::ltu_p (high_bound, vr0.min))
+ else if (wi::ltu_p (high_bound, wi::to_wide (vr0.min)))
{
/* [0xffffff00, 0xffffffff] << [1, 2]
== [0xfffffc00, 0xfffffffe]. */
@@ -2649,8 +2662,8 @@ extract_range_from_binary_expr_1 (value_range *vr,
/* [-1, 1] << [1, 2] == [-4, 4]. */
low_bound = complement;
high_bound = bound;
- if (wi::lts_p (vr0.max, high_bound)
- && wi::lts_p (low_bound, vr0.min))
+ if (wi::lts_p (wi::to_wide (vr0.max), high_bound)
+ && wi::lts_p (low_bound, wi::to_wide (vr0.min)))
{
/* For non-negative numbers, we're shifting out only
zeroes, the value increases monotonically.
@@ -2793,14 +2806,12 @@ extract_range_from_binary_expr_1 (value_range *vr,
signop sgn = TYPE_SIGN (expr_type);
unsigned int prec = TYPE_PRECISION (expr_type);
wide_int wmin, wmax, tmp;
- wide_int zero = wi::zero (prec);
- wide_int one = wi::one (prec);
if (vr1.type == VR_RANGE && !symbolic_range_p (&vr1))
{
- wmax = wi::sub (vr1.max, one);
+ wmax = wi::to_wide (vr1.max) - 1;
if (sgn == SIGNED)
{
- tmp = wi::sub (wi::minus_one (prec), vr1.min);
+ tmp = -1 - wi::to_wide (vr1.min);
wmax = wi::smax (wmax, tmp);
}
}
@@ -2809,28 +2820,28 @@ extract_range_from_binary_expr_1 (value_range *vr,
wmax = wi::max_value (prec, sgn);
/* X % INT_MIN may be INT_MAX. */
if (sgn == UNSIGNED)
- wmax = wmax - one;
+ wmax = wmax - 1;
}
if (sgn == UNSIGNED)
- wmin = zero;
+ wmin = wi::zero (prec);
else
{
wmin = -wmax;
if (vr0.type == VR_RANGE && TREE_CODE (vr0.min) == INTEGER_CST)
{
- tmp = vr0.min;
- if (wi::gts_p (tmp, zero))
- tmp = zero;
+ tmp = wi::to_wide (vr0.min);
+ if (wi::gts_p (tmp, 0))
+ tmp = wi::zero (prec);
wmin = wi::smax (wmin, tmp);
}
}
if (vr0.type == VR_RANGE && TREE_CODE (vr0.max) == INTEGER_CST)
{
- tmp = vr0.max;
+ tmp = wi::to_wide (vr0.max);
if (sgn == SIGNED && wi::neg_p (tmp))
- tmp = zero;
+ tmp = wi::zero (prec);
wmax = wi::min (wmax, tmp, sgn);
}
@@ -2875,7 +2886,7 @@ extract_range_from_binary_expr_1 (value_range *vr,
range. */
if (vr0p && range_int_cst_p (vr0p))
{
- wide_int w = vr1p->min;
+ wide_int w = wi::to_wide (vr1p->min);
int m = 0, n = 0;
if (code == BIT_IOR_EXPR)
w = ~w;
@@ -2891,7 +2902,8 @@ extract_range_from_binary_expr_1 (value_range *vr,
m = wi::ctz (w) - n;
}
wide_int mask = wi::mask (m + n, true, w.get_precision ());
- if (wi::eq_p (mask & vr0p->min, mask & vr0p->max))
+ if ((mask & wi::to_wide (vr0p->min))
+ == (mask & wi::to_wide (vr0p->max)))
{
min = int_const_binop (code, vr0p->min, vr1p->min);
max = int_const_binop (code, vr0p->max, vr1p->min);
@@ -2914,16 +2926,20 @@ extract_range_from_binary_expr_1 (value_range *vr,
&& tree_int_cst_sgn (vr0.max) < 0
&& tree_int_cst_sgn (vr1.max) < 0)
{
- wmax = wi::min (wmax, vr0.max, TYPE_SIGN (expr_type));
- wmax = wi::min (wmax, vr1.max, TYPE_SIGN (expr_type));
+ wmax = wi::min (wmax, wi::to_wide (vr0.max),
+ TYPE_SIGN (expr_type));
+ wmax = wi::min (wmax, wi::to_wide (vr1.max),
+ TYPE_SIGN (expr_type));
}
/* If either input range contains only non-negative values
we can truncate the result range maximum to the respective
maximum of the input range. */
if (int_cst_range0 && tree_int_cst_sgn (vr0.min) >= 0)
- wmax = wi::min (wmax, vr0.max, TYPE_SIGN (expr_type));
+ wmax = wi::min (wmax, wi::to_wide (vr0.max),
+ TYPE_SIGN (expr_type));
if (int_cst_range1 && tree_int_cst_sgn (vr1.min) >= 0)
- wmax = wi::min (wmax, vr1.max, TYPE_SIGN (expr_type));
+ wmax = wi::min (wmax, wi::to_wide (vr1.max),
+ TYPE_SIGN (expr_type));
max = wide_int_to_tree (expr_type, wmax);
cmp = compare_values (min, max);
/* PR68217: In case of signed & sign-bit-CST should
@@ -2936,10 +2952,10 @@ extract_range_from_binary_expr_1 (value_range *vr,
if (!TYPE_UNSIGNED (expr_type)
&& ((int_cst_range0
&& value_range_constant_singleton (&vr0)
- && !wi::cmps (vr0.min, sign_bit))
+ && !wi::cmps (wi::to_wide (vr0.min), sign_bit))
|| (int_cst_range1
&& value_range_constant_singleton (&vr1)
- && !wi::cmps (vr1.min, sign_bit))))
+ && !wi::cmps (wi::to_wide (vr1.min), sign_bit))))
{
min = TYPE_MIN_VALUE (expr_type);
max = build_int_cst (expr_type, 0);
@@ -2958,16 +2974,20 @@ extract_range_from_binary_expr_1 (value_range *vr,
&& tree_int_cst_sgn (vr0.min) >= 0
&& tree_int_cst_sgn (vr1.min) >= 0)
{
- wmin = wi::max (wmin, vr0.min, TYPE_SIGN (expr_type));
- wmin = wi::max (wmin, vr1.min, TYPE_SIGN (expr_type));
+ wmin = wi::max (wmin, wi::to_wide (vr0.min),
+ TYPE_SIGN (expr_type));
+ wmin = wi::max (wmin, wi::to_wide (vr1.min),
+ TYPE_SIGN (expr_type));
}
/* If either input range contains only negative values
we can truncate the minimum of the result range to the
respective minimum range. */
if (int_cst_range0 && tree_int_cst_sgn (vr0.max) < 0)
- wmin = wi::max (wmin, vr0.min, TYPE_SIGN (expr_type));
+ wmin = wi::max (wmin, wi::to_wide (vr0.min),
+ TYPE_SIGN (expr_type));
if (int_cst_range1 && tree_int_cst_sgn (vr1.max) < 0)
- wmin = wi::max (wmin, vr1.min, TYPE_SIGN (expr_type));
+ wmin = wi::max (wmin, wi::to_wide (vr1.min),
+ TYPE_SIGN (expr_type));
min = wide_int_to_tree (expr_type, wmin);
}
else if (code == BIT_XOR_EXPR)
@@ -4044,7 +4064,7 @@ adjust_range_with_scev (value_range *vr, struct loop *loop,
if (!overflow
&& wi::fits_to_tree_p (wtmp, TREE_TYPE (init))
&& (sgn == UNSIGNED
- || wi::gts_p (wtmp, 0) == wi::gts_p (step, 0)))
+ || wi::gts_p (wtmp, 0) == wi::gts_p (wi::to_wide (step), 0)))
{
tem = wide_int_to_tree (TREE_TYPE (init), wtmp);
extract_range_from_binary_expr (&maxvr, PLUS_EXPR,
@@ -4966,9 +4986,9 @@ overflow_comparison_p_1 (enum tree_code code, tree op0, tree op1,
wide_int max = wi::max_value (TYPE_PRECISION (type), UNSIGNED);
tree inc = gimple_assign_rhs2 (op1_def);
if (reversed)
- *new_cst = wide_int_to_tree (type, max + inc);
+ *new_cst = wide_int_to_tree (type, max + wi::to_wide (inc));
else
- *new_cst = wide_int_to_tree (type, max - inc);
+ *new_cst = wide_int_to_tree (type, max - wi::to_wide (inc));
return true;
}
}
@@ -5290,15 +5310,15 @@ register_edge_assert_for_2 (tree name, edge e,
wide_int minval
= wi::min_value (prec, TYPE_SIGN (TREE_TYPE (val)));
new_val = val2;
- if (minval == new_val)
+ if (minval == wi::to_wide (new_val))
new_val = NULL_TREE;
}
else
{
wide_int maxval
= wi::max_value (prec, TYPE_SIGN (TREE_TYPE (val)));
- mask |= val2;
- if (mask == maxval)
+ mask |= wi::to_wide (val2);
+ if (wi::eq_p (mask, maxval))
new_val = NULL_TREE;
else
new_val = wide_int_to_tree (TREE_TYPE (val2), mask);
@@ -5373,8 +5393,8 @@ register_edge_assert_for_2 (tree name, edge e,
bool valid_p = false, valn, cst2n;
enum tree_code ccode = comp_code;
- valv = wide_int::from (val, nprec, UNSIGNED);
- cst2v = wide_int::from (cst2, nprec, UNSIGNED);
+ valv = wide_int::from (wi::to_wide (val), nprec, UNSIGNED);
+ cst2v = wide_int::from (wi::to_wide (cst2), nprec, UNSIGNED);
valn = wi::neg_p (valv, TYPE_SIGN (TREE_TYPE (val)));
cst2n = wi::neg_p (cst2v, TYPE_SIGN (TREE_TYPE (val)));
/* If CST2 doesn't have most significant bit set,
@@ -5671,9 +5691,10 @@ is_masked_range_test (tree name, tree valt, enum tree_code cond_code,
if (TREE_CODE (t) != SSA_NAME || TREE_CODE (maskt) != INTEGER_CST)
return false;
- wide_int mask = maskt;
+ wi::tree_to_wide_ref mask = wi::to_wide (maskt);
wide_int inv_mask = ~mask;
- wide_int val = valt; // Assume VALT is INTEGER_CST
+ /* Assume VALT is INTEGER_CST. */
+ wi::tree_to_wide_ref val = wi::to_wide (valt);
if ((inv_mask & (inv_mask + 1)) != 0
|| (val & mask) != val)
@@ -6022,7 +6043,8 @@ find_switch_asserts (basic_block bb, gswitch *last)
next_min = CASE_LOW (next_cl);
next_max = CASE_HIGH (next_cl);
- wide_int difference = wi::sub (next_min, max ? max : min);
+ wide_int difference = (wi::to_wide (next_min)
+ - wi::to_wide (max ? max : min));
if (wi::eq_p (difference, 1))
max = next_max ? next_max : next_min;
else
@@ -6953,7 +6975,8 @@ maybe_set_nonzero_bits (basic_block bb, tree var)
return;
}
cst = gimple_assign_rhs2 (stmt);
- set_nonzero_bits (var, wi::bit_and_not (get_nonzero_bits (var), cst));
+ set_nonzero_bits (var, wi::bit_and_not (get_nonzero_bits (var),
+ wi::to_wide (cst)));
}
/* Convert range assertion expressions into the implied copies and
@@ -7547,7 +7570,7 @@ vrp_evaluate_conditional_warnv_with_ops (enum tree_code code, tree op0,
B = A + 1; if (A < B) -> B = A + 1; if (B != 0)
B = A - 1; if (B > A) -> B = A - 1; if (A == 0)
B = A - 1; if (B < A) -> B = A - 1; if (A != 0) */
- else if (wi::eq_p (x, max - 1))
+ else if (wi::to_wide (x) == max - 1)
{
op0 = op1;
op1 = wide_int_to_tree (TREE_TYPE (op0), 0);
@@ -8658,7 +8681,7 @@ intersect_ranges (enum value_range_type *vr0type,
== TYPE_PRECISION (ptr_type_node))
&& TREE_CODE (vr1max) == INTEGER_CST
&& TREE_CODE (vr1min) == INTEGER_CST
- && (wi::clz (wi::sub (vr1max, vr1min))
+ && (wi::clz (wi::to_wide (vr1max) - wi::to_wide (vr1min))
< TYPE_PRECISION (TREE_TYPE (*vr0min)) / 2))
;
/* Else choose the range. */
@@ -9679,7 +9702,8 @@ range_fits_type_p (value_range *vr, unsigned dest_precision, signop dest_sgn)
a signed wide_int, while a negative value cannot be represented
by an unsigned wide_int. */
if (src_sgn != dest_sgn
- && (wi::lts_p (vr->min, 0) || wi::lts_p (vr->max, 0)))
+ && (wi::lts_p (wi::to_wide (vr->min), 0)
+ || wi::lts_p (wi::to_wide (vr->max), 0)))
return false;
/* Then we can perform the conversion on both ends and compare
@@ -10275,7 +10299,7 @@ two_valued_val_range_p (tree var, tree *a, tree *b)
return false;
if (vr->type == VR_RANGE
- && wi::sub (vr->max, vr->min) == 1)
+ && wi::to_wide (vr->max) - wi::to_wide (vr->min) == 1)
{
*a = vr->min;
*b = vr->max;
@@ -10284,8 +10308,10 @@ two_valued_val_range_p (tree var, tree *a, tree *b)
/* ~[TYPE_MIN + 1, TYPE_MAX - 1] */
if (vr->type == VR_ANTI_RANGE
- && wi::sub (vr->min, vrp_val_min (TREE_TYPE (var))) == 1
- && wi::sub (vrp_val_max (TREE_TYPE (var)), vr->max) == 1)
+ && (wi::to_wide (vr->min)
+ - wi::to_wide (vrp_val_min (TREE_TYPE (var)))) == 1
+ && (wi::to_wide (vrp_val_max (TREE_TYPE (var)))
+ - wi::to_wide (vr->max)) == 1)
{
*a = vrp_val_min (TREE_TYPE (var));
*b = vrp_val_max (TREE_TYPE (var));
@@ -10850,8 +10876,9 @@ vrp_finalize (bool warn_array_bounds_p)
vr_value[i]->max) == 1)))
set_ptr_nonnull (name);
else if (!POINTER_TYPE_P (TREE_TYPE (name)))
- set_range_info (name, vr_value[i]->type, vr_value[i]->min,
- vr_value[i]->max);
+ set_range_info (name, vr_value[i]->type,
+ wi::to_wide (vr_value[i]->min),
+ wi::to_wide (vr_value[i]->max));
}
substitute_and_fold (op_with_constant_singleton_value_range, vrp_fold_stmt);
@@ -11047,8 +11074,9 @@ evrp_dom_walker::before_dom_children (basic_block bb)
|| vr_result.type == VR_ANTI_RANGE)
&& (TREE_CODE (vr_result.min) == INTEGER_CST)
&& (TREE_CODE (vr_result.max) == INTEGER_CST))
- set_range_info (lhs,
- vr_result.type, vr_result.min, vr_result.max);
+ set_range_info (lhs, vr_result.type,
+ wi::to_wide (vr_result.min),
+ wi::to_wide (vr_result.max));
}
else if (POINTER_TYPE_P (TREE_TYPE (lhs))
&& ((vr_result.type == VR_RANGE
@@ -11121,7 +11149,9 @@ evrp_dom_walker::before_dom_children (basic_block bb)
|| vr.type == VR_ANTI_RANGE)
&& (TREE_CODE (vr.min) == INTEGER_CST)
&& (TREE_CODE (vr.max) == INTEGER_CST))
- set_range_info (output, vr.type, vr.min, vr.max);
+ set_range_info (output, vr.type,
+ wi::to_wide (vr.min),
+ wi::to_wide (vr.max));
}
else if (POINTER_TYPE_P (TREE_TYPE (output))
&& ((vr.type == VR_RANGE