* tree-vrp.c (simplify_abs_using_ranges): Simplify.
From-SVN: r226779
This commit is contained in:
parent
a6810021af
commit
8299dd5cbb
2 changed files with 11 additions and 21 deletions
|
@ -1,5 +1,7 @@
|
|||
2015-08-11 Nathan Sidwell <nathan@acm.org>
|
||||
|
||||
* tree-vrp.c (simplify_abs_using_ranges): Simplify.
|
||||
|
||||
* tree-ssa-phiopt.c (minmax_replacement): Create new ssa name if
|
||||
we're not the only contributor to target phi.
|
||||
|
||||
|
|
|
@ -9152,37 +9152,25 @@ simplify_div_or_mod_using_ranges (gimple stmt)
|
|||
static bool
|
||||
simplify_abs_using_ranges (gimple stmt)
|
||||
{
|
||||
tree val = NULL;
|
||||
tree op = gimple_assign_rhs1 (stmt);
|
||||
tree type = TREE_TYPE (op);
|
||||
value_range_t *vr = get_value_range (op);
|
||||
|
||||
if (TYPE_UNSIGNED (type))
|
||||
{
|
||||
val = integer_zero_node;
|
||||
}
|
||||
else if (vr)
|
||||
if (vr)
|
||||
{
|
||||
tree val = NULL;
|
||||
bool sop = false;
|
||||
|
||||
val = compare_range_with_value (LE_EXPR, vr, integer_zero_node, &sop);
|
||||
if (!val)
|
||||
{
|
||||
/* The range is neither <= 0 nor > 0. Now see if it is
|
||||
either < 0 or >= 0. */
|
||||
sop = false;
|
||||
val = compare_range_with_value (GE_EXPR, vr, integer_zero_node,
|
||||
val = compare_range_with_value (LT_EXPR, vr, integer_zero_node,
|
||||
&sop);
|
||||
|
||||
if (val)
|
||||
{
|
||||
if (integer_zerop (val))
|
||||
val = integer_one_node;
|
||||
else if (integer_onep (val))
|
||||
val = integer_zero_node;
|
||||
}
|
||||
}
|
||||
|
||||
if (val
|
||||
&& (integer_onep (val) || integer_zerop (val)))
|
||||
if (val)
|
||||
{
|
||||
if (sop && issue_strict_overflow_warning (WARN_STRICT_OVERFLOW_MISC))
|
||||
{
|
||||
|
@ -9198,10 +9186,10 @@ simplify_abs_using_ranges (gimple stmt)
|
|||
}
|
||||
|
||||
gimple_assign_set_rhs1 (stmt, op);
|
||||
if (integer_onep (val))
|
||||
gimple_assign_set_rhs_code (stmt, NEGATE_EXPR);
|
||||
else
|
||||
if (integer_zerop (val))
|
||||
gimple_assign_set_rhs_code (stmt, SSA_NAME);
|
||||
else
|
||||
gimple_assign_set_rhs_code (stmt, NEGATE_EXPR);
|
||||
update_stmt (stmt);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue