+2 if VAL1 != VAL2
This is similar to tree_int_cst_compare but supports pointer values
- and values that cannot be compared at compile time.
-
- If STRICT_OVERFLOW_P is not NULL, then set *STRICT_OVERFLOW_P to
- true if the return value is only valid if we assume that signed
- overflow is undefined. */
+ and values that cannot be compared at compile time. */
int
-compare_values_warnv (tree val1, tree val2, bool *strict_overflow_p)
+compare_values (tree val1, tree val2)
{
if (val1 == val2)
return 0;
if (!overflow_undefined)
return -2;
- if (strict_overflow_p != NULL
- /* Symbolic range building sets the no-warning bit to declare
- that overflow doesn't happen. */
- && (!inv1 || !warning_suppressed_p (val1, OPT_Woverflow))
- && (!inv2 || !warning_suppressed_p (val2, OPT_Woverflow)))
- *strict_overflow_p = true;
-
if (!inv1)
inv1 = build_int_cst (TREE_TYPE (val1), 0);
if (!inv2)
if (!overflow_undefined)
return -2;
- if (strict_overflow_p != NULL
- /* Symbolic range building sets the no-warning bit to declare
- that overflow doesn't happen. */
- && (!sym1 || !warning_suppressed_p (val1, OPT_Woverflow))
- && (!sym2 || !warning_suppressed_p (val2, OPT_Woverflow)))
- *strict_overflow_p = true;
-
const signop sgn = TYPE_SIGN (TREE_TYPE (val1));
tree cst = cst1 ? val1 : val2;
tree inv = cst1 ? inv2 : inv1;
}
}
-/* Compare values like compare_values_warnv. */
-
-int
-compare_values (tree val1, tree val2)
-{
- bool sop;
- return compare_values_warnv (val1, val2, &sop);
-}
-
/* Helper for overflow_comparison_p
OP0 CODE OP1 is a comparison. Examine the comparison and potentially
#include "value-range.h"
extern int compare_values (tree, tree);
-extern int compare_values_warnv (tree, tree, bool *);
extern enum value_range_kind intersect_range_with_nonzero_bits
(enum value_range_kind, wide_int *, wide_int *, const wide_int &, signop);
a known value range VR.
If there is one and only one value which will satisfy the
- conditional, then return that value. Else return NULL.
-
- If signed overflow must be undefined for the value to satisfy
- the conditional, then set *STRICT_OVERFLOW_P to true. */
+ conditional, then return that value. Else return NULL. */
static tree
test_for_singularity (enum tree_code cond_code, tree op0,
{
tree one = build_int_cst (TREE_TYPE (op0), 1);
max = fold_build2 (MINUS_EXPR, TREE_TYPE (op0), max, one);
- /* Signal to compare_values_warnv this expr doesn't overflow. */
- if (EXPR_P (max))
- suppress_warning (max, OPT_Woverflow);
}
}
else if (cond_code == GE_EXPR || cond_code == GT_EXPR)
{
tree one = build_int_cst (TREE_TYPE (op0), 1);
min = fold_build2 (PLUS_EXPR, TREE_TYPE (op0), min, one);
- /* Signal to compare_values_warnv this expr doesn't overflow. */
- if (EXPR_P (min))
- suppress_warning (min, OPT_Woverflow);
}
}