to provide it through dataflow propagation. */
return (!name_registered_for_update_p (t)
&& depth < param_max_ssa_name_query_depth
- && gimple_stmt_nonnegative_warnv_p (SSA_NAME_DEF_STMT (t),
- strict_overflow_p, depth));
+ && gimple_stmt_nonnegative_p (SSA_NAME_DEF_STMT (t), depth));
default:
return tree_simple_nonnegative_warnv_p (TREE_CODE (t), TREE_TYPE (t));
}
}
-/* Return true if T is known to be non-negative. If the return
- value is based on the assumption that signed overflow is undefined,
- set *STRICT_OVERFLOW_P to true; otherwise, don't change
- *STRICT_OVERFLOW_P. DEPTH is the current nesting depth of the query. */
+/* Return true if T is known to be non-negative.
+ DEPTH is the current nesting depth of the query. */
bool
-tree_call_nonnegative_warnv_p (tree type, combined_fn fn, tree arg0, tree arg1,
- bool *strict_overflow_p, int depth)
+tree_call_nonnegative_p (tree type, combined_fn fn, tree arg0, tree arg1,
+ int depth)
{
+ /* The RECURSE () macro counts with a strict_overflow_p bool
+ pointer being declared beforehand. */
+ bool val = false;
+ bool *strict_overflow_p = &val;
+
switch (fn)
{
CASE_CFN_ACOS:
return tree_simple_nonnegative_warnv_p (CALL_EXPR, type);
}
-/* Return true if T is known to be non-negative. If the return
- value is based on the assumption that signed overflow is undefined,
- set *STRICT_OVERFLOW_P to true; otherwise, don't change
- *STRICT_OVERFLOW_P. DEPTH is the current nesting depth of the query. */
+/* Return true if T is known to be non-negative.
+ DEPTH is the current nesting depth of the query. */
static bool
-tree_invalid_nonnegative_warnv_p (tree t, bool *strict_overflow_p, int depth)
+tree_invalid_nonnegative_p (tree t, int depth)
{
enum tree_code code = TREE_CODE (t);
if (TYPE_UNSIGNED (TREE_TYPE (t)))
return true;
+ /* The RECURSE () macro counts with a strict_overflow_p bool
+ pointer being declared beforehand. */
+ bool val = false;
+ bool *strict_overflow_p = &val;
+
switch (code)
{
case TARGET_EXPR:
tree arg0 = call_expr_nargs (t) > 0 ? CALL_EXPR_ARG (t, 0) : NULL_TREE;
tree arg1 = call_expr_nargs (t) > 1 ? CALL_EXPR_ARG (t, 1) : NULL_TREE;
- return tree_call_nonnegative_warnv_p (TREE_TYPE (t),
- get_call_combined_fn (t),
- arg0,
- arg1,
- strict_overflow_p, depth);
+ return tree_call_nonnegative_p (TREE_TYPE (t),
+ get_call_combined_fn (t),
+ arg0,
+ arg1,
+ depth);
}
case COMPOUND_EXPR:
case MODIFY_EXPR:
#undef RECURSE
#undef tree_expr_nonnegative_warnv_p
-/* Return true if T is known to be non-negative. If the return
- value is based on the assumption that signed overflow is undefined,
- set *STRICT_OVERFLOW_P to true; otherwise, don't change
- *STRICT_OVERFLOW_P. DEPTH is the current nesting depth of the query. */
+/* Return true if T is known to be non-negative.
+ DEPTH is the current nesting depth of the query. */
bool
-tree_expr_nonnegative_warnv_p (tree t, bool *strict_overflow_p, int depth)
+tree_expr_nonnegative_warnv_p (tree t,
+ bool *strict_overflow_p ATTRIBUTE_UNUSED,
+ int depth)
{
enum tree_code code;
if (error_operand_p (t))
return tree_single_nonnegative_p (t, depth);
default:
- return tree_invalid_nonnegative_warnv_p (t, strict_overflow_p, depth);
+ return tree_invalid_nonnegative_p (t, depth);
}
}
extern bool tree_unary_nonnegative_p (enum tree_code, tree, tree, int);
extern bool tree_binary_nonnegative_p (enum tree_code, tree, tree, tree, int);
extern bool tree_single_nonnegative_p (tree, int);
-extern bool tree_call_nonnegative_warnv_p (tree, combined_fn, tree, tree,
- bool *, int);
+extern bool tree_call_nonnegative_p (tree, combined_fn, tree, tree, int);
extern bool integer_valued_real_unary_p (tree_code, tree, int);
extern bool integer_valued_real_binary_p (tree_code, tree, tree, int);
}
/* Return true if return value of call STMT is known to be non-negative.
- If the return value is based on the assumption that signed overflow is
- undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't change
- *STRICT_OVERFLOW_P. DEPTH is the current nesting depth of the query. */
+ DEPTH is the current nesting depth of the query. */
static bool
-gimple_call_nonnegative_warnv_p (gimple *stmt, bool *strict_overflow_p,
- int depth)
+gimple_call_nonnegative_p (gimple *stmt, int depth)
{
tree arg0
= gimple_call_num_args (stmt) > 0 ? gimple_call_arg (stmt, 0) : NULL_TREE;
= gimple_call_num_args (stmt) > 1 ? gimple_call_arg (stmt, 1) : NULL_TREE;
tree lhs = gimple_call_lhs (stmt);
return (lhs
- && tree_call_nonnegative_warnv_p (TREE_TYPE (lhs),
- gimple_call_combined_fn (stmt),
- arg0, arg1,
- strict_overflow_p, depth));
+ && tree_call_nonnegative_p (TREE_TYPE (lhs),
+ gimple_call_combined_fn (stmt),
+ arg0, arg1, depth));
}
/* Return true if return value of call STMT is known to be non-negative.
}
/* Return true if STMT is known to compute a non-negative value.
- If the return value is based on the assumption that signed overflow is
- undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't change
- *STRICT_OVERFLOW_P. DEPTH is the current nesting depth of the query. */
+ DEPTH is the current nesting depth of the query. */
bool
-gimple_stmt_nonnegative_warnv_p (gimple *stmt, bool *strict_overflow_p,
- int depth)
+gimple_stmt_nonnegative_p (gimple *stmt, int depth)
{
tree type = gimple_range_type (stmt);
if (type && frange::supports_p (type))
case GIMPLE_ASSIGN:
return gimple_assign_nonnegative_p (stmt, depth);
case GIMPLE_CALL:
- return gimple_call_nonnegative_warnv_p (stmt, strict_overflow_p,
- depth);
+ return gimple_call_nonnegative_p (stmt, depth);
case GIMPLE_PHI:
return gimple_phi_nonnegative_p (stmt, depth);
default:
UNKNOWN_LOCATION, type, old_size, align);
}
-extern bool gimple_stmt_nonnegative_warnv_p (gimple *, bool *, int = 0);
+extern bool gimple_stmt_nonnegative_p (gimple *, int = 0);
extern bool gimple_stmt_integer_valued_real_p (gimple *, int = 0);
extern void mark_lhs_in_seq_for_dce (bitmap, gimple_seq);
// If the result is varying, check for basic nonnegativeness.
// Specifically this helps for now with strict enum in cases like
// g++.dg/warn/pr33738.C.
- bool so_p;
if (res && r.varying_p () && INTEGRAL_TYPE_P (r.type ())
- && gimple_stmt_nonnegative_warnv_p (s, &so_p))
+ && gimple_stmt_nonnegative_p (s))
r.set_nonnegative (r.type ());
if (!res)
return false;
tree lhs = gimple_call_lhs (call);
- bool strict_overflow_p;
- if (gimple_stmt_nonnegative_warnv_p (call, &strict_overflow_p))
+ if (gimple_stmt_nonnegative_p (call))
r.set_nonnegative (type);
else if (gimple_call_nonnull_result_p (call)
|| gimple_call_nonnull_arg (call))