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