Remove value_range_constant_singleton in favor of value_range::singleton_p.

From-SVN: r272182
This commit is contained in:
Aldy Hernandez 2019-06-12 12:53:20 +00:00 committed by Aldy Hernandez
parent 26d7a5e690
commit 57bbc3e2f0
5 changed files with 18 additions and 22 deletions

View File

@ -1,3 +1,12 @@
2019-06-12 Aldy Hernandez <aldyh@redhat.com>
* gimple-ssa-evrp.c (evrp_dom_walker::before_dom_children): Use
value_range::singleton_p.
* tree-vrp.c (value_range_constant_singleton): Remove.
* tree-vrp.h (value_range_constant_singleton): Remove.
* vr-values.c (vr_values::singleton): Use
value_range::singleton_p.
2019-06-12 Jakub Jelinek <jakub@redhat.com>
PR target/90811

View File

@ -111,8 +111,8 @@ evrp_dom_walker::before_dom_children (basic_block bb)
value_range *vr = evrp_range_analyzer.get_value_range (lhs);
/* Mark PHIs whose lhs we fully propagate for removal. */
tree val = value_range_constant_singleton (vr);
if (val && may_propagate_copy (lhs, val))
tree val;
if (vr->singleton_p (&val) && may_propagate_copy (lhs, val))
{
stmts_to_remove.safe_push (phi);
continue;
@ -162,7 +162,7 @@ evrp_dom_walker::before_dom_children (basic_block bb)
value_range *vr = evrp_range_analyzer.get_value_range (output);
/* Mark stmts whose output we fully propagate for removal. */
if ((val = value_range_constant_singleton (vr))
if (vr->singleton_p (&val)
&& may_propagate_copy (output, val)
&& !stmt_could_throw_p (cfun, stmt)
&& !gimple_has_side_effects (stmt))
@ -244,8 +244,8 @@ evrp_dom_walker::before_dom_children (basic_block bb)
|| virtual_operand_p (arg))
continue;
value_range *vr = evrp_range_analyzer.get_value_range (arg);
tree val = value_range_constant_singleton (vr);
if (val && may_propagate_copy (arg, val))
tree val;
if (vr->singleton_p (&val) && may_propagate_copy (arg, val))
propagate_value (use_p, val);
}
}

View File

@ -1154,21 +1154,6 @@ range_includes_p (const value_range_base *vr, HOST_WIDE_INT x)
return vr->may_contain_p (build_int_cst (vr->type (), x));
}
/* If *VR has a value range that is a single constant value return that,
otherwise return NULL_TREE.
?? This actually returns TRUE for [&x, &x], so perhaps "constant"
is not the best name. */
tree
value_range_constant_singleton (const value_range_base *vr)
{
tree result = NULL;
if (vr->singleton_p (&result))
return result;
return NULL;
}
/* Value range wrapper for wide_int_range_set_zero_nonzero_bits.
Compute MAY_BE_NONZERO and MUST_BE_NONZERO bit masks for range in VR.

View File

@ -259,7 +259,6 @@ extern bool infer_value_range (gimple *, tree, tree_code *, tree *);
extern bool vrp_bitmap_equal_p (const_bitmap, const_bitmap);
extern tree value_range_constant_singleton (const value_range_base *);
extern bool range_int_cst_p (const value_range_base *);
extern bool range_int_cst_singleton_p (const value_range_base *);

View File

@ -387,7 +387,10 @@ vr_values::op_with_constant_singleton_value_range (tree op)
if (TREE_CODE (op) != SSA_NAME)
return NULL_TREE;
return value_range_constant_singleton (get_value_range (op));
tree t;
if (get_value_range (op)->singleton_p (&t))
return t;
return NULL;
}
/* Return true if op is in a boolean [0, 1] value-range. */