From: Aldy Hernandez Date: Wed, 12 Jun 2019 12:53:20 +0000 (+0000) Subject: Remove value_range_constant_singleton in favor of value_range::singleton_p. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=57bbc3e2f030b810766916189ec802aed5db5041;p=gcc.git Remove value_range_constant_singleton in favor of value_range::singleton_p. From-SVN: r272182 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5e3afcaed21..d58835d08a5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-06-12 Aldy Hernandez + + * 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 PR target/90811 diff --git a/gcc/gimple-ssa-evrp.c b/gcc/gimple-ssa-evrp.c index 16a8f7ffc23..5b993886912 100644 --- a/gcc/gimple-ssa-evrp.c +++ b/gcc/gimple-ssa-evrp.c @@ -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); } } diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index d94de2b22ee..065152aca3b 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -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. diff --git a/gcc/tree-vrp.h b/gcc/tree-vrp.h index c0801ff8041..62d72868708 100644 --- a/gcc/tree-vrp.h +++ b/gcc/tree-vrp.h @@ -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 *); diff --git a/gcc/vr-values.c b/gcc/vr-values.c index d3653e80789..e151550d963 100644 --- a/gcc/vr-values.c +++ b/gcc/vr-values.c @@ -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. */