range_int_cst_singleton_p (value_range_t *vr)
{
return (range_int_cst_p (vr)
- && !TREE_OVERFLOW (vr->min)
- && !TREE_OVERFLOW (vr->max)
+ && !is_overflow_infinity (vr->min)
+ && !is_overflow_infinity (vr->max)
&& tree_int_cst_equal (vr->min, vr->max));
}
return false;
}
-/* Return true if T, an SSA_NAME, is known to be nonnegative. Return
- false otherwise or if no value range information is available. */
-
-bool
-ssa_name_nonnegative_p (const_tree t)
-{
- value_range_t *vr = get_value_range (t);
-
- if (INTEGRAL_TYPE_P (t)
- && TYPE_UNSIGNED (t))
- return true;
-
- if (!vr)
- return false;
-
- return value_range_nonnegative_p (vr);
-}
-
/* If *VR has a value rante that is a single constant value return that,
otherwise return NULL_TREE. */
all should be optimized away above us. */
if ((cond_code == LT_EXPR
&& compare_values (max, min) == 0)
- || (CONSTANT_CLASS_P (max) && TREE_OVERFLOW (max)))
+ || is_overflow_infinity (max))
set_value_range_to_varying (vr_p);
else
{
all should be optimized away above us. */
if ((cond_code == GT_EXPR
&& compare_values (min, max) == 0)
- || (CONSTANT_CLASS_P (min) && TREE_OVERFLOW (min)))
+ || is_overflow_infinity (min))
set_value_range_to_varying (vr_p);
else
{
*may_be_nonzero = wi::minus_one (TYPE_PRECISION (expr_type));
*must_be_nonzero = wi::zero (TYPE_PRECISION (expr_type));
if (!range_int_cst_p (vr)
- || TREE_OVERFLOW (vr->min)
- || TREE_OVERFLOW (vr->max))
+ || is_overflow_infinity (vr->min)
+ || is_overflow_infinity (vr->max))
return false;
if (range_int_cst_singleton_p (vr))
&& integer_nonzerop (vr0->min))
|| (vr0->type == VR_ANTI_RANGE
&& integer_zerop (vr0->min)))
- && !TREE_OVERFLOW (vr0->min))
+ && !is_overflow_infinity (vr0->min))
mini = 1;
/* If some high bits are known to be zero,
we can decrease the maximum. */
if (vr0->type == VR_RANGE
&& TREE_CODE (vr0->max) == INTEGER_CST
- && !TREE_OVERFLOW (vr0->max))
+ && !is_overflow_infinity (vr0->max))
maxi = tree_floor_log2 (vr0->max) + 1;
}
goto bitop_builtin;
result maximum. */
if (vr0->type == VR_RANGE
&& TREE_CODE (vr0->min) == INTEGER_CST
- && !TREE_OVERFLOW (vr0->min))
+ && !is_overflow_infinity (vr0->min))
{
maxi = prec - 1 - tree_floor_log2 (vr0->min);
if (maxi != prec)
}
else if (vr0->type == VR_ANTI_RANGE
&& integer_zerop (vr0->min)
- && !TREE_OVERFLOW (vr0->min))
+ && !is_overflow_infinity (vr0->min))
{
maxi = prec - 1;
mini = 0;
result minimum. */
if (vr0->type == VR_RANGE
&& TREE_CODE (vr0->max) == INTEGER_CST
- && !TREE_OVERFLOW (vr0->max))
+ && !is_overflow_infinity (vr0->max))
{
mini = prec - 1 - tree_floor_log2 (vr0->max);
if (mini == prec)
&& integer_nonzerop (vr0->min))
|| (vr0->type == VR_ANTI_RANGE
&& integer_zerop (vr0->min)))
- && !TREE_OVERFLOW (vr0->min))
+ && !is_overflow_infinity (vr0->min))
{
mini = 0;
maxi = prec - 1;
we can decrease the result maximum. */
if (vr0->type == VR_RANGE
&& TREE_CODE (vr0->max) == INTEGER_CST
- && !TREE_OVERFLOW (vr0->max))
+ && !is_overflow_infinity (vr0->max))
{
maxi = tree_floor_log2 (vr0->max);
/* For vr0 [0, 0] give up. */
/* Never build an assert comparing against an integer constant with
TREE_OVERFLOW set. This confuses our undefined overflow warning
machinery. */
- if (TREE_CODE (val) == INTEGER_CST
- && TREE_OVERFLOW (val))
- val = wide_int_to_tree (TREE_TYPE (val), val);
+ if (TREE_OVERFLOW_P (val))
+ val = drop_tree_overflow (val);
/* The new assertion A will be inserted at BB or E. We need to
determine if the new location is dominated by a previously
for (i = 0; i < rpo_cnt; ++i)
bb_rpo[rpo[i]] = i;
+ /* Pre-seed loop latch liveness from loop header PHI nodes. Due to
+ the order we compute liveness and insert asserts we otherwise
+ fail to insert asserts into the loop latch. */
+ loop_p loop;
+ loop_iterator li;
+ FOR_EACH_LOOP (li, loop, 0)
+ {
+ i = loop->latch->index;
+ unsigned int j = single_succ_edge (loop->latch)->dest_idx;
+ for (gimple_stmt_iterator gsi = gsi_start_phis (loop->header);
+ !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple phi = gsi_stmt (gsi);
+ if (virtual_operand_p (gimple_phi_result (phi)))
+ continue;
+ tree arg = gimple_phi_arg_def (phi, j);
+ if (TREE_CODE (arg) == SSA_NAME)
+ {
+ if (live[i] == NULL)
+ {
+ live[i] = sbitmap_alloc (num_ssa_names);
+ bitmap_clear (live[i]);
+ }
+ bitmap_set_bit (live[i], SSA_NAME_VERSION (arg));
+ }
+ }
+ }
+
need_asserts = false;
for (i = rpo_cnt - 1; i >= 0; --i)
{
else
{
if (is_overflow_infinity (arg))
- {
- arg = copy_node (arg);
- TREE_OVERFLOW (arg) = 0;
- }
+ arg = drop_tree_overflow (arg);
vr_arg.type = VR_RANGE;
vr_arg.min = arg;