bitmap.c (bitmap_head::dump): New.
* bitmap.c (bitmap_head::dump): New. * bitmap.h (bitmap_head): Add dump(). * gimple-ssa-evrp-analyze.c (evrp_range_analyzer::try_find_new_range): Adjust for value_range API. (evrp_range_analyzer::set_ssa_range_info): Same. (evrp_range_analyzer::record_ranges_from_phis): Same. (evrp_range_analyzer::record_ranges_from_stmt): Same. * gimple-ssa-evrp.c (evrp_dom_walker::before_dom_children): Same. * gimple-ssa-sprintf.c (get_int_range): Same. (format_integer): Same. (sprintf_dom_walker::handle_gimple_call): Same. * ipa-cp.c (ipcp_vr_lattice::meet_with_1): Same. (ipcp_vr_lattice::top_p): Same. (ipcp_vr_lattice::bottom_p): Same. (ipcp_vr_lattice::set_to_bottom): Same. (ipa_vr_operation_and_type_effects): Same. (propagate_vr_across_jump_function): Same. (ipcp_store_vr_results): Same. * ipa-prop.c (struct ipa_vr_ggc_hash_traits): Same. (ipa_print_node_jump_functions_for_edge): Same. (ipa_get_value_range): Same. (ipa_compute_jump_functions_for_edge): Same. (ipa_write_jump_function): Same. * tree-ssa-dom.c (simplify_stmt_for_jump_threading): Same. * tree-ssa-threadedge.c (record_temporary_equivalences_from_phis): Same. * vr-values.c (set_value_range_to_nonnegative): Same. (set_value_range_to_truthvalue): Same. (vr_values::get_value_range): Same. (vr_values::set_defs_to_varying): Same. (vr_values::update_value_range): Same. (symbolic_range_based_on_p): Same. (vr_values::op_with_boolean_value_range_p): Same. (vr_values::extract_range_for_var_from_comparison_expr): Same. (vr_values::extract_range_from_ssa_name): Same. (vr_values::extract_range_from_binary_expr): Same. (vr_values::extract_range_from_unary_expr): Same. (vr_values::extract_range_from_cond_expr): Same. (vr_values::extract_range_from_comparison): Same. (vr_values::check_for_binary_op_overflow): Same. (vr_values::extract_range_basic): Same. (vr_values::extract_range_from_assignment): Same. (compare_ranges): Same. (compare_range_with_value): Same. (vr_values::adjust_range_with_scev): Same. (vrp_valueize): Same. (vrp_valueize_1): Same. (vr_values::get_vr_for_comparison): Same. (vr_values::compare_name_with_value): Same. (vr_values::compare_names): Same. (vr_values::vrp_evaluate_conditional): Same. (find_case_label_ranges): Same. (vr_values::vrp_visit_switch_stmt): Same. (vr_values::extract_range_from_phi_node): Same. (vr_values::simplify_div_or_mod_using_ranges): Same. (vr_values::simplify_bit_ops_using_ranges): Same. (test_for_singularity): Same. (range_fits_type_p): Same. (vr_values::simplify_cond_using_ranges_1): Same. (vr_values::simplify_switch_using_ranges): Same. (vr_values::simplify_float_conversion_using_ranges): Same. (vr_values::two_valued_val_range_p): Same. (vr_values::add_equivalence): Move to value_range::equiv_add. * vr-values.h (vr_values::add_equivalence): Remove. (VR_INITIALIZER): Remove. * tree-vrp.c (value_range::set): New. (value_range::equiv_add): New. (value_range::value_range): New. (value_range::deep_copy): New. (value_range::check): New. (value_range::equal_p): New. (value_range::ignore_equivs_equal_p): New. (value_range::operator==): New. (value_range::operator!=): New. (value_range::symbolic_p): New. (value_range::numeric_p): New. (value_range::set_undefined): New. (value_range::set_varying): New. (value_range::may_contain_p): New. (value_range::equiv_clear): New. (value_range::singleton_p): New. (value_range::intersect): New. (value_range::dump): New. (value_range::set_and_canonicalize): New. (set_value_range): Adjust for value_range API. (set_value_range_to_undefined): Same. (set_value_range_to_varying): Same. (set_and_canonicalize_value_range): Same. (set_value_range_to_nonnull): Same. (set_value_range_to_null): Same. (range_is_null): Same. (range_is_nonnull): Same. (range_int_cst_p): Same. (range_int_cst_singleton_p): Same. (symbolic_range_p): Same. (range_includes_zero_p): Same. (value_range_constant_singleton): Same. (vrp_set_zero_nonzero_bits): Same. (ranges_from_anti_range): Same. (extract_range_into_wide_ints): Same. (extract_range_from_multiplicative_op): Same. (set_value_range_with_overflow): Same. (extract_range_from_binary_expr_1): Same. (extract_range_from_unary_expr): Same. (dump_value_range): Same. (debug_value_range): Same. (vrp_prop::check_array_ref): Same. (vrp_prop::check_mem_ref): Same. (vrp_prop::vrp_initialize): Same. (vrp_prop::visit_stmt): Same. (intersect_ranges): Same. (vrp_prop::visit_phi): Same. (vrp_prop::vrp_finalize): Same. (determine_value_range_1): Same. (determine_value_range): Same. (vrp_intersect_ranges_1): Rename to... (vrp_intersect_1): this. (vrp_intersect_ranges): Rename to... (value_range::intersect_helper): ...this. (vrp_meet_1): Rename to... (value_range::union_helper): ...this. (vrp_meet): Rename to... (value_range::union_): ...this. (copy_value_range): Remove. * tree-vrp.h (struct value_range): Rewrite into a proper class. (value_range::vrtype): New. (value_range::type): New. (value_range::equiv): New. (value_range::min): New. (value_range::max): New. (value_range::varying_p): New. (value_range::undefined_p): New. (value_range::null_p): New. (value_range::equiv_add): New. (copy_value_range): Remove. From-SVN: r265241
This commit is contained in:
parent
033eb56717
commit
54994253d3
138
gcc/ChangeLog
138
gcc/ChangeLog
|
@ -1,3 +1,141 @@
|
|||
2018-10-09 Aldy Hernandez <aldyh@redhat.com>
|
||||
|
||||
* bitmap.c (bitmap_head::dump): New.
|
||||
* bitmap.h (bitmap_head): Add dump().
|
||||
* gimple-ssa-evrp-analyze.c
|
||||
(evrp_range_analyzer::try_find_new_range): Adjust for value_range API.
|
||||
(evrp_range_analyzer::set_ssa_range_info): Same.
|
||||
(evrp_range_analyzer::record_ranges_from_phis): Same.
|
||||
(evrp_range_analyzer::record_ranges_from_stmt): Same.
|
||||
* gimple-ssa-evrp.c (evrp_dom_walker::before_dom_children): Same.
|
||||
* gimple-ssa-sprintf.c (get_int_range): Same.
|
||||
(format_integer): Same.
|
||||
(sprintf_dom_walker::handle_gimple_call): Same.
|
||||
* ipa-cp.c (ipcp_vr_lattice::meet_with_1): Same.
|
||||
(ipcp_vr_lattice::top_p): Same.
|
||||
(ipcp_vr_lattice::bottom_p): Same.
|
||||
(ipcp_vr_lattice::set_to_bottom): Same.
|
||||
(ipa_vr_operation_and_type_effects): Same.
|
||||
(propagate_vr_across_jump_function): Same.
|
||||
(ipcp_store_vr_results): Same.
|
||||
* ipa-prop.c (struct ipa_vr_ggc_hash_traits): Same.
|
||||
(ipa_print_node_jump_functions_for_edge): Same.
|
||||
(ipa_get_value_range): Same.
|
||||
(ipa_compute_jump_functions_for_edge): Same.
|
||||
(ipa_write_jump_function): Same.
|
||||
* tree-ssa-dom.c (simplify_stmt_for_jump_threading): Same.
|
||||
* tree-ssa-threadedge.c (record_temporary_equivalences_from_phis):
|
||||
Same.
|
||||
* vr-values.c (set_value_range_to_nonnegative): Same.
|
||||
(set_value_range_to_truthvalue): Same.
|
||||
(vr_values::get_value_range): Same.
|
||||
(vr_values::set_defs_to_varying): Same.
|
||||
(vr_values::update_value_range): Same.
|
||||
(symbolic_range_based_on_p): Same.
|
||||
(vr_values::op_with_boolean_value_range_p): Same.
|
||||
(vr_values::extract_range_for_var_from_comparison_expr): Same.
|
||||
(vr_values::extract_range_from_ssa_name): Same.
|
||||
(vr_values::extract_range_from_binary_expr): Same.
|
||||
(vr_values::extract_range_from_unary_expr): Same.
|
||||
(vr_values::extract_range_from_cond_expr): Same.
|
||||
(vr_values::extract_range_from_comparison): Same.
|
||||
(vr_values::check_for_binary_op_overflow): Same.
|
||||
(vr_values::extract_range_basic): Same.
|
||||
(vr_values::extract_range_from_assignment): Same.
|
||||
(compare_ranges): Same.
|
||||
(compare_range_with_value): Same.
|
||||
(vr_values::adjust_range_with_scev): Same.
|
||||
(vrp_valueize): Same.
|
||||
(vrp_valueize_1): Same.
|
||||
(vr_values::get_vr_for_comparison): Same.
|
||||
(vr_values::compare_name_with_value): Same.
|
||||
(vr_values::compare_names): Same.
|
||||
(vr_values::vrp_evaluate_conditional): Same.
|
||||
(find_case_label_ranges): Same.
|
||||
(vr_values::vrp_visit_switch_stmt): Same.
|
||||
(vr_values::extract_range_from_phi_node): Same.
|
||||
(vr_values::simplify_div_or_mod_using_ranges): Same.
|
||||
(vr_values::simplify_bit_ops_using_ranges): Same.
|
||||
(test_for_singularity): Same.
|
||||
(range_fits_type_p): Same.
|
||||
(vr_values::simplify_cond_using_ranges_1): Same.
|
||||
(vr_values::simplify_switch_using_ranges): Same.
|
||||
(vr_values::simplify_float_conversion_using_ranges): Same.
|
||||
(vr_values::two_valued_val_range_p): Same.
|
||||
(vr_values::add_equivalence): Move to value_range::equiv_add.
|
||||
* vr-values.h (vr_values::add_equivalence): Remove.
|
||||
(VR_INITIALIZER): Remove.
|
||||
* tree-vrp.c (value_range::set): New.
|
||||
(value_range::equiv_add): New.
|
||||
(value_range::value_range): New.
|
||||
(value_range::deep_copy): New.
|
||||
(value_range::check): New.
|
||||
(value_range::equal_p): New.
|
||||
(value_range::ignore_equivs_equal_p): New.
|
||||
(value_range::operator==): New.
|
||||
(value_range::operator!=): New.
|
||||
(value_range::symbolic_p): New.
|
||||
(value_range::numeric_p): New.
|
||||
(value_range::set_undefined): New.
|
||||
(value_range::set_varying): New.
|
||||
(value_range::may_contain_p): New.
|
||||
(value_range::equiv_clear): New.
|
||||
(value_range::singleton_p): New.
|
||||
(value_range::intersect): New.
|
||||
(value_range::dump): New.
|
||||
(value_range::set_and_canonicalize): New.
|
||||
(set_value_range): Adjust for value_range API.
|
||||
(set_value_range_to_undefined): Same.
|
||||
(set_value_range_to_varying): Same.
|
||||
(set_and_canonicalize_value_range): Same.
|
||||
(set_value_range_to_nonnull): Same.
|
||||
(set_value_range_to_null): Same.
|
||||
(range_is_null): Same.
|
||||
(range_is_nonnull): Same.
|
||||
(range_int_cst_p): Same.
|
||||
(range_int_cst_singleton_p): Same.
|
||||
(symbolic_range_p): Same.
|
||||
(range_includes_zero_p): Same.
|
||||
(value_range_constant_singleton): Same.
|
||||
(vrp_set_zero_nonzero_bits): Same.
|
||||
(ranges_from_anti_range): Same.
|
||||
(extract_range_into_wide_ints): Same.
|
||||
(extract_range_from_multiplicative_op): Same.
|
||||
(set_value_range_with_overflow): Same.
|
||||
(extract_range_from_binary_expr_1): Same.
|
||||
(extract_range_from_unary_expr): Same.
|
||||
(dump_value_range): Same.
|
||||
(debug_value_range): Same.
|
||||
(vrp_prop::check_array_ref): Same.
|
||||
(vrp_prop::check_mem_ref): Same.
|
||||
(vrp_prop::vrp_initialize): Same.
|
||||
(vrp_prop::visit_stmt): Same.
|
||||
(intersect_ranges): Same.
|
||||
(vrp_prop::visit_phi): Same.
|
||||
(vrp_prop::vrp_finalize): Same.
|
||||
(determine_value_range_1): Same.
|
||||
(determine_value_range): Same.
|
||||
(vrp_intersect_ranges_1): Rename to...
|
||||
(vrp_intersect_1): this.
|
||||
(vrp_intersect_ranges): Rename to...
|
||||
(value_range::intersect_helper): ...this.
|
||||
(vrp_meet_1): Rename to...
|
||||
(value_range::union_helper): ...this.
|
||||
(vrp_meet): Rename to...
|
||||
(value_range::union_): ...this.
|
||||
(copy_value_range): Remove.
|
||||
* tree-vrp.h (struct value_range): Rewrite into a proper class.
|
||||
(value_range::vrtype): New.
|
||||
(value_range::type): New.
|
||||
(value_range::equiv): New.
|
||||
(value_range::min): New.
|
||||
(value_range::max): New.
|
||||
(value_range::varying_p): New.
|
||||
(value_range::undefined_p): New.
|
||||
(value_range::null_p): New.
|
||||
(value_range::equiv_add): New.
|
||||
(copy_value_range): Remove.
|
||||
|
||||
2018-10-17 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
* Makefile.in (SELFTEST_TARGETS): New.
|
||||
|
|
|
@ -2164,6 +2164,12 @@ debug (const bitmap_head *ptr)
|
|||
fprintf (stderr, "<nil>\n");
|
||||
}
|
||||
|
||||
void
|
||||
bitmap_head::dump ()
|
||||
{
|
||||
debug (this);
|
||||
}
|
||||
|
||||
#if CHECKING_P
|
||||
|
||||
namespace selftest {
|
||||
|
|
|
@ -243,6 +243,7 @@ struct GTY(()) bitmap_head {
|
|||
bitmap_element * GTY((skip(""))) current; /* Last element looked at. */
|
||||
bitmap_obstack *obstack; /* Obstack to allocate elements from.
|
||||
If NULL, then use GGC allocation. */
|
||||
void dump ();
|
||||
};
|
||||
|
||||
/* Global data */
|
||||
|
|
|
@ -3139,7 +3139,7 @@ expand_builtin_strnlen (tree exp, rtx target, machine_mode target_mode)
|
|||
return NULL_RTX;
|
||||
|
||||
wide_int min, max;
|
||||
enum value_range_type rng = get_range_info (bound, &min, &max);
|
||||
enum value_range_kind rng = get_range_info (bound, &min, &max);
|
||||
if (rng != VR_RANGE)
|
||||
return NULL_RTX;
|
||||
|
||||
|
@ -3227,7 +3227,7 @@ determine_block_size (tree len, rtx len_rtx,
|
|||
else
|
||||
{
|
||||
wide_int min, max;
|
||||
enum value_range_type range_type = VR_UNDEFINED;
|
||||
enum value_range_kind range_type = VR_UNDEFINED;
|
||||
|
||||
/* Determine bounds from the type. */
|
||||
if (tree_fits_uhwi_p (TYPE_MIN_VALUE (TREE_TYPE (len))))
|
||||
|
@ -3629,7 +3629,7 @@ compute_objsize (tree dest, int ostype)
|
|||
&& INTEGRAL_TYPE_P (TREE_TYPE (off)))
|
||||
{
|
||||
wide_int min, max;
|
||||
enum value_range_type rng = get_range_info (off, &min, &max);
|
||||
enum value_range_kind rng = get_range_info (off, &min, &max);
|
||||
|
||||
if (rng == VR_RANGE)
|
||||
{
|
||||
|
|
|
@ -1255,7 +1255,7 @@ get_size_range (tree exp, tree range[2], bool allow_zero /* = false */)
|
|||
bool integral = INTEGRAL_TYPE_P (exptype);
|
||||
|
||||
wide_int min, max;
|
||||
enum value_range_type range_type;
|
||||
enum value_range_kind range_type;
|
||||
|
||||
if (integral)
|
||||
range_type = determine_value_range (exp, &min, &max);
|
||||
|
|
|
@ -46,6 +46,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|||
typedef int64_t gcov_type;
|
||||
typedef uint64_t gcov_type_unsigned;
|
||||
|
||||
struct bitmap_obstack;
|
||||
struct bitmap_head;
|
||||
typedef struct bitmap_head *bitmap;
|
||||
typedef const struct bitmap_head *const_bitmap;
|
||||
|
|
|
@ -9255,7 +9255,7 @@ bool
|
|||
expr_not_equal_to (tree t, const wide_int &w)
|
||||
{
|
||||
wide_int min, max, nz;
|
||||
value_range_type rtype;
|
||||
value_range_kind rtype;
|
||||
switch (TREE_CODE (t))
|
||||
{
|
||||
case INTEGER_CST:
|
||||
|
|
|
@ -649,7 +649,7 @@ size_must_be_zero_p (tree size)
|
|||
return false;
|
||||
|
||||
wide_int min, max;
|
||||
enum value_range_type rtype = get_range_info (size, &min, &max);
|
||||
enum value_range_kind rtype = get_range_info (size, &min, &max);
|
||||
if (rtype != VR_ANTI_RANGE)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -2123,7 +2123,7 @@ dump_ssaname_info (pretty_printer *buffer, tree node, int spc)
|
|||
&& SSA_NAME_RANGE_INFO (node))
|
||||
{
|
||||
wide_int min, max, nonzero_bits;
|
||||
value_range_type range_type = get_range_info (node, &min, &max);
|
||||
value_range_kind range_type = get_range_info (node, &min, &max);
|
||||
|
||||
if (range_type == VR_VARYING)
|
||||
pp_printf (buffer, "# RANGE VR_VARYING");
|
||||
|
|
|
@ -82,7 +82,7 @@ value_range *
|
|||
evrp_range_analyzer::try_find_new_range (tree name,
|
||||
tree op, tree_code code, tree limit)
|
||||
{
|
||||
value_range vr = VR_INITIALIZER;
|
||||
value_range vr;
|
||||
value_range *old_vr = get_value_range (name);
|
||||
|
||||
/* Discover VR when condition is true. */
|
||||
|
@ -90,11 +90,11 @@ evrp_range_analyzer::try_find_new_range (tree name,
|
|||
limit, &vr);
|
||||
/* If we found any usable VR, set the VR to ssa_name and create a
|
||||
PUSH old value in the stack with the old VR. */
|
||||
if (vr.type == VR_RANGE || vr.type == VR_ANTI_RANGE)
|
||||
if (!vr.undefined_p () && !vr.varying_p ())
|
||||
{
|
||||
if (old_vr->type == vr.type
|
||||
&& vrp_operand_equal_p (old_vr->min, vr.min)
|
||||
&& vrp_operand_equal_p (old_vr->max, vr.max))
|
||||
if (old_vr->kind () == vr.kind ()
|
||||
&& vrp_operand_equal_p (old_vr->min (), vr.min ())
|
||||
&& vrp_operand_equal_p (old_vr->max (), vr.max ()))
|
||||
return NULL;
|
||||
value_range *new_vr = vr_values->allocate_value_range ();
|
||||
*new_vr = vr;
|
||||
|
@ -110,13 +110,10 @@ evrp_range_analyzer::set_ssa_range_info (tree lhs, value_range *vr)
|
|||
/* Set the SSA with the value range. */
|
||||
if (INTEGRAL_TYPE_P (TREE_TYPE (lhs)))
|
||||
{
|
||||
if ((vr->type == VR_RANGE
|
||||
|| vr->type == VR_ANTI_RANGE)
|
||||
&& (TREE_CODE (vr->min) == INTEGER_CST)
|
||||
&& (TREE_CODE (vr->max) == INTEGER_CST))
|
||||
set_range_info (lhs, vr->type,
|
||||
wi::to_wide (vr->min),
|
||||
wi::to_wide (vr->max));
|
||||
if (vr->constant_p ())
|
||||
set_range_info (lhs, vr->kind (),
|
||||
wi::to_wide (vr->min ()),
|
||||
wi::to_wide (vr->max ()));
|
||||
}
|
||||
else if (POINTER_TYPE_P (TREE_TYPE (lhs))
|
||||
&& range_includes_zero_p (vr) == 0)
|
||||
|
@ -241,7 +238,7 @@ evrp_range_analyzer::record_ranges_from_phis (basic_block bb)
|
|||
if (virtual_operand_p (lhs))
|
||||
continue;
|
||||
|
||||
value_range vr_result = VR_INITIALIZER;
|
||||
value_range vr_result;
|
||||
bool interesting = stmt_interesting_for_vrp (phi);
|
||||
if (!has_unvisited_preds && interesting)
|
||||
vr_values->extract_range_from_phi_node (phi, &vr_result);
|
||||
|
@ -284,7 +281,7 @@ evrp_range_analyzer::record_ranges_from_stmt (gimple *stmt, bool temporary)
|
|||
else if (stmt_interesting_for_vrp (stmt))
|
||||
{
|
||||
edge taken_edge;
|
||||
value_range vr = VR_INITIALIZER;
|
||||
value_range vr;
|
||||
vr_values->extract_range_from_stmt (stmt, &taken_edge, &output, &vr);
|
||||
if (output)
|
||||
{
|
||||
|
@ -315,7 +312,7 @@ evrp_range_analyzer::record_ranges_from_stmt (gimple *stmt, bool temporary)
|
|||
bitmaps. Ugh. */
|
||||
value_range *new_vr = vr_values->allocate_value_range ();
|
||||
*new_vr = vr;
|
||||
new_vr->equiv = NULL;
|
||||
new_vr->equiv_clear ();
|
||||
push_value_range (output, new_vr);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,8 +161,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 ((vr->type == VR_RANGE || vr->type == VR_ANTI_RANGE)
|
||||
&& (val = value_range_constant_singleton (vr))
|
||||
if ((val = value_range_constant_singleton (vr))
|
||||
&& may_propagate_copy (output, val)
|
||||
&& !stmt_could_throw_p (stmt)
|
||||
&& !gimple_has_side_effects (stmt))
|
||||
|
|
|
@ -1052,9 +1052,7 @@ get_int_range (tree arg, HOST_WIDE_INT *pmin, HOST_WIDE_INT *pmax,
|
|||
{
|
||||
/* Try to determine the range of values of the integer argument. */
|
||||
value_range *vr = vr_values->get_value_range (arg);
|
||||
if (vr->type == VR_RANGE
|
||||
&& TREE_CODE (vr->min) == INTEGER_CST
|
||||
&& TREE_CODE (vr->max) == INTEGER_CST)
|
||||
if (range_int_cst_p (vr))
|
||||
{
|
||||
HOST_WIDE_INT type_min
|
||||
= (TYPE_UNSIGNED (argtype)
|
||||
|
@ -1063,8 +1061,8 @@ get_int_range (tree arg, HOST_WIDE_INT *pmin, HOST_WIDE_INT *pmax,
|
|||
|
||||
HOST_WIDE_INT type_max = tree_to_uhwi (TYPE_MAX_VALUE (argtype));
|
||||
|
||||
*pmin = TREE_INT_CST_LOW (vr->min);
|
||||
*pmax = TREE_INT_CST_LOW (vr->max);
|
||||
*pmin = TREE_INT_CST_LOW (vr->min ());
|
||||
*pmax = TREE_INT_CST_LOW (vr->max ());
|
||||
|
||||
if (*pmin < *pmax)
|
||||
{
|
||||
|
@ -1354,12 +1352,10 @@ format_integer (const directive &dir, tree arg, vr_values *vr_values)
|
|||
/* Try to determine the range of values of the integer argument
|
||||
(range information is not available for pointers). */
|
||||
value_range *vr = vr_values->get_value_range (arg);
|
||||
if (vr->type == VR_RANGE
|
||||
&& TREE_CODE (vr->min) == INTEGER_CST
|
||||
&& TREE_CODE (vr->max) == INTEGER_CST)
|
||||
if (range_int_cst_p (vr))
|
||||
{
|
||||
argmin = vr->min;
|
||||
argmax = vr->max;
|
||||
argmin = vr->min ();
|
||||
argmax = vr->max ();
|
||||
|
||||
/* Set KNOWNRANGE if the argument is in a known subrange
|
||||
of the directive's type and neither width nor precision
|
||||
|
@ -1372,12 +1368,11 @@ format_integer (const directive &dir, tree arg, vr_values *vr_values)
|
|||
res.argmin = argmin;
|
||||
res.argmax = argmax;
|
||||
}
|
||||
else if (vr->type == VR_ANTI_RANGE)
|
||||
else if (vr->kind () == VR_ANTI_RANGE)
|
||||
{
|
||||
/* Handle anti-ranges if/when bug 71690 is resolved. */
|
||||
}
|
||||
else if (vr->type == VR_VARYING
|
||||
|| vr->type == VR_UNDEFINED)
|
||||
else if (vr->varying_p () || vr->undefined_p ())
|
||||
{
|
||||
/* The argument here may be the result of promoting the actual
|
||||
argument to int. Try to determine the type of the actual
|
||||
|
@ -3903,12 +3898,10 @@ sprintf_dom_walker::handle_gimple_call (gimple_stmt_iterator *gsi)
|
|||
and use the greater of the two at level 1 and the smaller
|
||||
of them at level 2. */
|
||||
value_range *vr = evrp_range_analyzer.get_value_range (size);
|
||||
if (vr->type == VR_RANGE
|
||||
&& TREE_CODE (vr->min) == INTEGER_CST
|
||||
&& TREE_CODE (vr->max) == INTEGER_CST)
|
||||
if (range_int_cst_p (vr))
|
||||
dstsize = (warn_level < 2
|
||||
? TREE_INT_CST_LOW (vr->max)
|
||||
: TREE_INT_CST_LOW (vr->min));
|
||||
? TREE_INT_CST_LOW (vr->max ())
|
||||
: TREE_INT_CST_LOW (vr->min ()));
|
||||
|
||||
/* The destination size is not constant. If the function is
|
||||
bounded (e.g., snprintf) a lower bound of zero doesn't
|
||||
|
|
|
@ -272,7 +272,7 @@ alloca_call_type_by_arg (tree arg, tree arg_casted, edge e,
|
|||
&& TREE_CODE (limit) == SSA_NAME)
|
||||
{
|
||||
wide_int min, max;
|
||||
value_range_type range_type = get_range_info (limit, &min, &max);
|
||||
value_range_kind range_type = get_range_info (limit, &min, &max);
|
||||
|
||||
if (range_type == VR_UNDEFINED || range_type == VR_VARYING)
|
||||
return alloca_type_and_limit (ALLOCA_BOUND_UNKNOWN);
|
||||
|
@ -364,7 +364,7 @@ alloca_call_type (gimple *stmt, bool is_vla, tree *invalid_casted_type)
|
|||
// Check the range info if available.
|
||||
if (TREE_CODE (len) == SSA_NAME)
|
||||
{
|
||||
value_range_type range_type = get_range_info (len, &min, &max);
|
||||
value_range_kind range_type = get_range_info (len, &min, &max);
|
||||
if (range_type == VR_RANGE)
|
||||
{
|
||||
if (wi::leu_p (max, max_size))
|
||||
|
|
|
@ -312,7 +312,7 @@ builtin_memref::extend_offset_range (tree offset)
|
|||
if (TREE_CODE (offset) == SSA_NAME)
|
||||
{
|
||||
wide_int min, max;
|
||||
value_range_type rng = get_range_info (offset, &min, &max);
|
||||
value_range_kind rng = get_range_info (offset, &min, &max);
|
||||
if (rng == VR_RANGE)
|
||||
{
|
||||
offrange[0] += offset_int::from (min, SIGNED);
|
||||
|
|
50
gcc/ipa-cp.c
50
gcc/ipa-cp.c
|
@ -314,7 +314,7 @@ public:
|
|||
inline bool set_to_bottom ();
|
||||
bool meet_with (const value_range *p_vr);
|
||||
bool meet_with (const ipcp_vr_lattice &other);
|
||||
void init () { m_vr.type = VR_UNDEFINED; }
|
||||
void init () { gcc_assert (m_vr.undefined_p ()); }
|
||||
void print (FILE * f);
|
||||
|
||||
private:
|
||||
|
@ -914,28 +914,21 @@ ipcp_vr_lattice::meet_with (const value_range *p_vr)
|
|||
return meet_with_1 (p_vr);
|
||||
}
|
||||
|
||||
/* Meet the current value of the lattice with value ranfge described by
|
||||
OTHER_VR lattice. */
|
||||
/* Meet the current value of the lattice with value range described by
|
||||
OTHER_VR lattice. Return TRUE if anything changed. */
|
||||
|
||||
bool
|
||||
ipcp_vr_lattice::meet_with_1 (const value_range *other_vr)
|
||||
{
|
||||
tree min = m_vr.min, max = m_vr.max;
|
||||
value_range_type type = m_vr.type;
|
||||
|
||||
if (bottom_p ())
|
||||
return false;
|
||||
|
||||
if (other_vr->type == VR_VARYING)
|
||||
if (other_vr->varying_p ())
|
||||
return set_to_bottom ();
|
||||
|
||||
vrp_meet (&m_vr, other_vr);
|
||||
if (type != m_vr.type
|
||||
|| min != m_vr.min
|
||||
|| max != m_vr.max)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
value_range save (m_vr);
|
||||
m_vr.union_ (other_vr);
|
||||
return !m_vr.ignore_equivs_equal_p (save);
|
||||
}
|
||||
|
||||
/* Return true if value range information in the lattice is yet unknown. */
|
||||
|
@ -943,7 +936,7 @@ ipcp_vr_lattice::meet_with_1 (const value_range *other_vr)
|
|||
bool
|
||||
ipcp_vr_lattice::top_p () const
|
||||
{
|
||||
return m_vr.type == VR_UNDEFINED;
|
||||
return m_vr.undefined_p ();
|
||||
}
|
||||
|
||||
/* Return true if value range information in the lattice is known to be
|
||||
|
@ -952,7 +945,7 @@ ipcp_vr_lattice::top_p () const
|
|||
bool
|
||||
ipcp_vr_lattice::bottom_p () const
|
||||
{
|
||||
return m_vr.type == VR_VARYING;
|
||||
return m_vr.varying_p ();
|
||||
}
|
||||
|
||||
/* Set value range information in the lattice to bottom. Return true if it
|
||||
|
@ -961,9 +954,9 @@ ipcp_vr_lattice::bottom_p () const
|
|||
bool
|
||||
ipcp_vr_lattice::set_to_bottom ()
|
||||
{
|
||||
if (m_vr.type == VR_VARYING)
|
||||
if (m_vr.varying_p ())
|
||||
return false;
|
||||
m_vr.type = VR_VARYING;
|
||||
m_vr.set_varying ();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1882,12 +1875,11 @@ ipa_vr_operation_and_type_effects (value_range *dst_vr, value_range *src_vr,
|
|||
enum tree_code operation,
|
||||
tree dst_type, tree src_type)
|
||||
{
|
||||
memset (dst_vr, 0, sizeof (*dst_vr));
|
||||
*dst_vr = value_range ();
|
||||
extract_range_from_unary_expr (dst_vr, operation, dst_type, src_vr, src_type);
|
||||
if (dst_vr->type == VR_RANGE || dst_vr->type == VR_ANTI_RANGE)
|
||||
return true;
|
||||
else
|
||||
if (dst_vr->varying_p () || dst_vr->undefined_p ())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Propagate value range across jump function JFUNC that is associated with
|
||||
|
@ -1940,11 +1932,7 @@ propagate_vr_across_jump_function (cgraph_edge *cs, ipa_jump_func *jfunc,
|
|||
if (TREE_OVERFLOW_P (val))
|
||||
val = drop_tree_overflow (val);
|
||||
|
||||
value_range tmpvr;
|
||||
memset (&tmpvr, 0, sizeof (tmpvr));
|
||||
tmpvr.type = VR_RANGE;
|
||||
tmpvr.min = val;
|
||||
tmpvr.max = val;
|
||||
value_range tmpvr (VR_RANGE, val, val);
|
||||
return dest_lat->meet_with (&tmpvr);
|
||||
}
|
||||
}
|
||||
|
@ -1953,7 +1941,7 @@ propagate_vr_across_jump_function (cgraph_edge *cs, ipa_jump_func *jfunc,
|
|||
if (jfunc->m_vr
|
||||
&& ipa_vr_operation_and_type_effects (&vr, jfunc->m_vr, NOP_EXPR,
|
||||
param_type,
|
||||
TREE_TYPE (jfunc->m_vr->min)))
|
||||
jfunc->m_vr->type ()))
|
||||
return dest_lat->meet_with (&vr);
|
||||
else
|
||||
return dest_lat->set_to_bottom ();
|
||||
|
@ -5028,9 +5016,9 @@ ipcp_store_vr_results (void)
|
|||
&& !plats->m_value_range.top_p ())
|
||||
{
|
||||
vr.known = true;
|
||||
vr.type = plats->m_value_range.m_vr.type;
|
||||
vr.min = wi::to_wide (plats->m_value_range.m_vr.min);
|
||||
vr.max = wi::to_wide (plats->m_value_range.m_vr.max);
|
||||
vr.type = plats->m_value_range.m_vr.kind ();
|
||||
vr.min = wi::to_wide (plats->m_value_range.m_vr.min ());
|
||||
vr.max = wi::to_wide (plats->m_value_range.m_vr.max ());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -113,16 +113,16 @@ struct ipa_vr_ggc_hash_traits : public ggc_cache_remove <value_range *>
|
|||
static hashval_t
|
||||
hash (const value_range *p)
|
||||
{
|
||||
gcc_checking_assert (!p->equiv);
|
||||
inchash::hash hstate (p->type);
|
||||
hstate.add_ptr (p->min);
|
||||
hstate.add_ptr (p->max);
|
||||
gcc_checking_assert (!p->equiv ());
|
||||
inchash::hash hstate (p->kind ());
|
||||
hstate.add_ptr (p->min ());
|
||||
hstate.add_ptr (p->max ());
|
||||
return hstate.end ();
|
||||
}
|
||||
static bool
|
||||
equal (const value_range *a, const value_range *b)
|
||||
{
|
||||
return a->type == b->type && a->min == b->min && a->max == b->max;
|
||||
return a->ignore_equivs_equal_p (*b);
|
||||
}
|
||||
static void
|
||||
mark_empty (value_range *&p)
|
||||
|
@ -398,10 +398,10 @@ ipa_print_node_jump_functions_for_edge (FILE *f, struct cgraph_edge *cs)
|
|||
{
|
||||
fprintf (f, " VR ");
|
||||
fprintf (f, "%s[",
|
||||
(jump_func->m_vr->type == VR_ANTI_RANGE) ? "~" : "");
|
||||
print_decs (wi::to_wide (jump_func->m_vr->min), f);
|
||||
(jump_func->m_vr->kind () == VR_ANTI_RANGE) ? "~" : "");
|
||||
print_decs (wi::to_wide (jump_func->m_vr->min ()), f);
|
||||
fprintf (f, ", ");
|
||||
print_decs (wi::to_wide (jump_func->m_vr->max), f);
|
||||
print_decs (wi::to_wide (jump_func->m_vr->max ()), f);
|
||||
fprintf (f, "]\n");
|
||||
}
|
||||
else
|
||||
|
@ -1789,13 +1789,9 @@ ipa_get_value_range (value_range *tmp)
|
|||
value_ranges. */
|
||||
|
||||
static value_range *
|
||||
ipa_get_value_range (enum value_range_type type, tree min, tree max)
|
||||
ipa_get_value_range (enum value_range_kind type, tree min, tree max)
|
||||
{
|
||||
value_range tmp;
|
||||
tmp.type = type;
|
||||
tmp.min = min;
|
||||
tmp.max = max;
|
||||
tmp.equiv = NULL;
|
||||
value_range tmp (type, min, max);
|
||||
return ipa_get_value_range (&tmp);
|
||||
}
|
||||
|
||||
|
@ -1804,7 +1800,7 @@ ipa_get_value_range (enum value_range_type type, tree min, tree max)
|
|||
same value_range structures. */
|
||||
|
||||
static void
|
||||
ipa_set_jfunc_vr (ipa_jump_func *jf, enum value_range_type type,
|
||||
ipa_set_jfunc_vr (ipa_jump_func *jf, enum value_range_kind type,
|
||||
tree min, tree max)
|
||||
{
|
||||
jf->m_vr = ipa_get_value_range (type, min, max);
|
||||
|
@ -1884,22 +1880,19 @@ ipa_compute_jump_functions_for_edge (struct ipa_func_body_info *fbi,
|
|||
else
|
||||
{
|
||||
wide_int min, max;
|
||||
value_range_type type;
|
||||
value_range_kind type;
|
||||
if (TREE_CODE (arg) == SSA_NAME
|
||||
&& param_type
|
||||
&& (type = get_range_info (arg, &min, &max))
|
||||
&& (type == VR_RANGE || type == VR_ANTI_RANGE))
|
||||
{
|
||||
value_range tmpvr,resvr;
|
||||
|
||||
tmpvr.type = type;
|
||||
tmpvr.min = wide_int_to_tree (TREE_TYPE (arg), min);
|
||||
tmpvr.max = wide_int_to_tree (TREE_TYPE (arg), max);
|
||||
tmpvr.equiv = NULL;
|
||||
memset (&resvr, 0, sizeof (resvr));
|
||||
value_range resvr;
|
||||
value_range tmpvr (type,
|
||||
wide_int_to_tree (TREE_TYPE (arg), min),
|
||||
wide_int_to_tree (TREE_TYPE (arg), max));
|
||||
extract_range_from_unary_expr (&resvr, NOP_EXPR, param_type,
|
||||
&tmpvr, TREE_TYPE (arg));
|
||||
if (resvr.type == VR_RANGE || resvr.type == VR_ANTI_RANGE)
|
||||
if (!resvr.undefined_p () && !resvr.varying_p ())
|
||||
ipa_set_jfunc_vr (jfunc, &resvr);
|
||||
else
|
||||
gcc_assert (!jfunc->m_vr);
|
||||
|
@ -4126,9 +4119,9 @@ ipa_write_jump_function (struct output_block *ob,
|
|||
if (jump_func->m_vr)
|
||||
{
|
||||
streamer_write_enum (ob->main_stream, value_rang_type,
|
||||
VR_LAST, jump_func->m_vr->type);
|
||||
stream_write_tree (ob, jump_func->m_vr->min, true);
|
||||
stream_write_tree (ob, jump_func->m_vr->max, true);
|
||||
VR_LAST, jump_func->m_vr->kind ());
|
||||
stream_write_tree (ob, jump_func->m_vr->min (), true);
|
||||
stream_write_tree (ob, jump_func->m_vr->max (), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4216,7 +4209,7 @@ ipa_read_jump_function (struct lto_input_block *ib,
|
|||
bool vr_known = bp_unpack_value (&vr_bp, 1);
|
||||
if (vr_known)
|
||||
{
|
||||
enum value_range_type type = streamer_read_enum (ib, value_range_type,
|
||||
enum value_range_kind type = streamer_read_enum (ib, value_range_kind,
|
||||
VR_LAST);
|
||||
tree min = stream_read_tree (ib, data_in);
|
||||
tree max = stream_read_tree (ib, data_in);
|
||||
|
@ -4647,7 +4640,7 @@ read_ipcp_transformation_info (lto_input_block *ib, cgraph_node *node,
|
|||
parm_vr->known = bp_unpack_value (&bp, 1);
|
||||
if (parm_vr->known)
|
||||
{
|
||||
parm_vr->type = streamer_read_enum (ib, value_range_type,
|
||||
parm_vr->type = streamer_read_enum (ib, value_range_kind,
|
||||
VR_LAST);
|
||||
parm_vr->min = streamer_read_wide_int (ib);
|
||||
parm_vr->max = streamer_read_wide_int (ib);
|
||||
|
|
|
@ -160,7 +160,7 @@ struct GTY(()) ipa_vr
|
|||
{
|
||||
/* The data fields below are valid only if known is true. */
|
||||
bool known;
|
||||
enum value_range_type type;
|
||||
enum value_range_kind type;
|
||||
wide_int min;
|
||||
wide_int max;
|
||||
};
|
||||
|
|
|
@ -721,7 +721,7 @@ split_constant_offset_1 (tree type, tree op0, enum tree_code code, tree op1,
|
|||
if (TREE_CODE (tmp_var) != SSA_NAME)
|
||||
return false;
|
||||
wide_int var_min, var_max;
|
||||
value_range_type vr_type = get_range_info (tmp_var, &var_min,
|
||||
value_range_kind vr_type = get_range_info (tmp_var, &var_min,
|
||||
&var_max);
|
||||
wide_int var_nonzero = get_nonzero_bits (tmp_var);
|
||||
signop sgn = TYPE_SIGN (itype);
|
||||
|
|
|
@ -882,25 +882,27 @@ simplify_stmt_for_jump_threading (gimple *stmt,
|
|||
return NULL_TREE;
|
||||
|
||||
value_range *vr = x_vr_values->get_value_range (op);
|
||||
if ((vr->type != VR_RANGE && vr->type != VR_ANTI_RANGE)
|
||||
|| symbolic_range_p (vr))
|
||||
if (vr->undefined_p ()
|
||||
|| vr->varying_p ()
|
||||
|| vr->symbolic_p ())
|
||||
return NULL_TREE;
|
||||
|
||||
if (vr->type == VR_RANGE)
|
||||
if (vr->kind () == VR_RANGE)
|
||||
{
|
||||
size_t i, j;
|
||||
|
||||
find_case_label_range (switch_stmt, vr->min, vr->max, &i, &j);
|
||||
find_case_label_range (switch_stmt, vr->min (), vr->max (), &i, &j);
|
||||
|
||||
if (i == j)
|
||||
{
|
||||
tree label = gimple_switch_label (switch_stmt, i);
|
||||
tree singleton;
|
||||
|
||||
if (CASE_HIGH (label) != NULL_TREE
|
||||
? (tree_int_cst_compare (CASE_LOW (label), vr->min) <= 0
|
||||
&& tree_int_cst_compare (CASE_HIGH (label), vr->max) >= 0)
|
||||
: (tree_int_cst_equal (CASE_LOW (label), vr->min)
|
||||
&& tree_int_cst_equal (vr->min, vr->max)))
|
||||
? (tree_int_cst_compare (CASE_LOW (label), vr->min ()) <= 0
|
||||
&& tree_int_cst_compare (CASE_HIGH (label), vr->max ()) >= 0)
|
||||
: (vr->singleton_p (&singleton)
|
||||
&& tree_int_cst_equal (CASE_LOW (label), singleton)))
|
||||
return label;
|
||||
|
||||
if (i > j)
|
||||
|
@ -908,7 +910,7 @@ simplify_stmt_for_jump_threading (gimple *stmt,
|
|||
}
|
||||
}
|
||||
|
||||
if (vr->type == VR_ANTI_RANGE)
|
||||
if (vr->kind () == VR_ANTI_RANGE)
|
||||
{
|
||||
unsigned n = gimple_switch_num_labels (switch_stmt);
|
||||
tree min_label = gimple_switch_label (switch_stmt, 1);
|
||||
|
@ -917,10 +919,10 @@ simplify_stmt_for_jump_threading (gimple *stmt,
|
|||
/* The default label will be taken only if the anti-range of the
|
||||
operand is entirely outside the bounds of all the (non-default)
|
||||
case labels. */
|
||||
if (tree_int_cst_compare (vr->min, CASE_LOW (min_label)) <= 0
|
||||
if (tree_int_cst_compare (vr->min (), CASE_LOW (min_label)) <= 0
|
||||
&& (CASE_HIGH (max_label) != NULL_TREE
|
||||
? tree_int_cst_compare (vr->max, CASE_HIGH (max_label)) >= 0
|
||||
: tree_int_cst_compare (vr->max, CASE_LOW (max_label)) >= 0))
|
||||
? tree_int_cst_compare (vr->max (), CASE_HIGH (max_label)) >= 0
|
||||
: tree_int_cst_compare (vr->max (), CASE_LOW (max_label)) >= 0))
|
||||
return gimple_switch_label (switch_stmt, 0);
|
||||
}
|
||||
return NULL_TREE;
|
||||
|
@ -936,11 +938,12 @@ simplify_stmt_for_jump_threading (gimple *stmt,
|
|||
{
|
||||
edge dummy_e;
|
||||
tree dummy_tree;
|
||||
value_range new_vr = VR_INITIALIZER;
|
||||
value_range new_vr;
|
||||
x_vr_values->extract_range_from_stmt (stmt, &dummy_e,
|
||||
&dummy_tree, &new_vr);
|
||||
if (range_int_cst_singleton_p (&new_vr))
|
||||
return new_vr.min;
|
||||
tree singleton;
|
||||
if (new_vr.singleton_p (&singleton))
|
||||
return singleton;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
|
|
@ -353,7 +353,7 @@ determine_value_range (struct loop *loop, tree type, tree var, mpz_t off,
|
|||
mpz_t minm, maxm;
|
||||
basic_block bb;
|
||||
wide_int minv, maxv;
|
||||
enum value_range_type rtype = VR_VARYING;
|
||||
enum value_range_kind rtype = VR_VARYING;
|
||||
|
||||
/* If the expression is a constant, we know its value exactly. */
|
||||
if (integer_zerop (var))
|
||||
|
@ -4673,7 +4673,7 @@ scev_var_range_cant_overflow (tree var, tree step, struct loop *loop)
|
|||
{
|
||||
tree type;
|
||||
wide_int minv, maxv, diff, step_wi;
|
||||
enum value_range_type rtype;
|
||||
enum value_range_kind rtype;
|
||||
|
||||
if (TREE_CODE (step) != INTEGER_CST || !INTEGRAL_TYPE_P (TREE_TYPE (var)))
|
||||
return false;
|
||||
|
|
|
@ -1200,7 +1200,7 @@ maybe_set_strlen_range (tree lhs, tree src, tree bound)
|
|||
else if (TREE_CODE (bound) == SSA_NAME)
|
||||
{
|
||||
wide_int minbound, maxbound;
|
||||
value_range_type rng = get_range_info (bound, &minbound, &maxbound);
|
||||
value_range_kind rng = get_range_info (bound, &minbound, &maxbound);
|
||||
if (rng == VR_RANGE)
|
||||
{
|
||||
/* For a bound in a known range, adjust the range determined
|
||||
|
@ -1856,7 +1856,7 @@ maybe_diag_stxncpy_trunc (gimple_stmt_iterator gsi, tree src, tree cnt)
|
|||
cntrange[0] = cntrange[1] = wi::to_wide (cnt);
|
||||
else if (TREE_CODE (cnt) == SSA_NAME)
|
||||
{
|
||||
enum value_range_type rng = get_range_info (cnt, cntrange, cntrange + 1);
|
||||
enum value_range_kind rng = get_range_info (cnt, cntrange, cntrange + 1);
|
||||
if (rng == VR_RANGE)
|
||||
;
|
||||
else if (rng == VR_ANTI_RANGE)
|
||||
|
@ -3682,7 +3682,7 @@ strlen_check_and_optimize_stmt (gimple_stmt_iterator *gsi, bool *cleanup_eh)
|
|||
if we don't have anything better. */
|
||||
wide_int min, max;
|
||||
tree type = TREE_TYPE (lhs);
|
||||
enum value_range_type vr
|
||||
enum value_range_kind vr
|
||||
= get_range_info (lhs, &min, &max);
|
||||
if (vr == VR_VARYING
|
||||
|| (vr == VR_RANGE
|
||||
|
|
|
@ -166,7 +166,7 @@ record_temporary_equivalences_from_phis (edge e,
|
|||
away in the VR stack. */
|
||||
vr_values *vr_values = evrp_range_analyzer->get_vr_values ();
|
||||
value_range *new_vr = vr_values->allocate_value_range ();
|
||||
memset (new_vr, 0, sizeof (value_range));
|
||||
*new_vr = value_range ();
|
||||
|
||||
/* There are three cases to consider:
|
||||
|
||||
|
@ -179,7 +179,7 @@ record_temporary_equivalences_from_phis (edge e,
|
|||
Otherwise set NEW_VR to varying. This may be overly
|
||||
conservative. */
|
||||
if (TREE_CODE (src) == SSA_NAME)
|
||||
copy_value_range (new_vr, vr_values->get_value_range (src));
|
||||
new_vr->deep_copy (vr_values->get_value_range (src));
|
||||
else if (TREE_CODE (src) == INTEGER_CST)
|
||||
set_value_range_to_value (new_vr, src, NULL);
|
||||
else
|
||||
|
|
|
@ -331,7 +331,7 @@ make_ssa_name_fn (struct function *fn, tree var, gimple *stmt,
|
|||
NAME. */
|
||||
|
||||
void
|
||||
set_range_info_raw (tree name, enum value_range_type range_type,
|
||||
set_range_info_raw (tree name, enum value_range_kind range_type,
|
||||
const wide_int_ref &min, const wide_int_ref &max)
|
||||
{
|
||||
gcc_assert (!POINTER_TYPE_P (TREE_TYPE (name)));
|
||||
|
@ -372,7 +372,7 @@ set_range_info_raw (tree name, enum value_range_type range_type,
|
|||
NAME while making sure we don't store useless range info. */
|
||||
|
||||
void
|
||||
set_range_info (tree name, enum value_range_type range_type,
|
||||
set_range_info (tree name, enum value_range_kind range_type,
|
||||
const wide_int_ref &min, const wide_int_ref &max)
|
||||
{
|
||||
gcc_assert (!POINTER_TYPE_P (TREE_TYPE (name)));
|
||||
|
@ -397,11 +397,11 @@ set_range_info (tree name, enum value_range_type range_type,
|
|||
}
|
||||
|
||||
|
||||
/* Gets range information MIN, MAX and returns enum value_range_type
|
||||
corresponding to tree ssa_name NAME. enum value_range_type returned
|
||||
/* Gets range information MIN, MAX and returns enum value_range_kind
|
||||
corresponding to tree ssa_name NAME. enum value_range_kind returned
|
||||
is used to determine if MIN and MAX are valid values. */
|
||||
|
||||
enum value_range_type
|
||||
enum value_range_kind
|
||||
get_range_info (const_tree name, wide_int *min, wide_int *max)
|
||||
{
|
||||
gcc_assert (!POINTER_TYPE_P (TREE_TYPE (name)));
|
||||
|
@ -727,7 +727,7 @@ duplicate_ssa_name_ptr_info (tree name, struct ptr_info_def *ptr_info)
|
|||
/* Creates a duplicate of the range_info_def at RANGE_INFO of type
|
||||
RANGE_TYPE for use by the SSA name NAME. */
|
||||
void
|
||||
duplicate_ssa_name_range_info (tree name, enum value_range_type range_type,
|
||||
duplicate_ssa_name_range_info (tree name, enum value_range_kind range_type,
|
||||
struct range_info_def *range_info)
|
||||
{
|
||||
struct range_info_def *new_range_info;
|
||||
|
|
|
@ -67,13 +67,13 @@ struct GTY ((variable_size)) range_info_def {
|
|||
if (VAR)
|
||||
|
||||
/* Sets the value range to SSA. */
|
||||
extern void set_range_info (tree, enum value_range_type, const wide_int_ref &,
|
||||
extern void set_range_info (tree, enum value_range_kind, const wide_int_ref &,
|
||||
const wide_int_ref &);
|
||||
extern void set_range_info_raw (tree, enum value_range_type,
|
||||
extern void set_range_info_raw (tree, enum value_range_kind,
|
||||
const wide_int_ref &,
|
||||
const wide_int_ref &);
|
||||
/* Gets the value range from SSA. */
|
||||
extern enum value_range_type get_range_info (const_tree, wide_int *,
|
||||
extern enum value_range_kind get_range_info (const_tree, wide_int *,
|
||||
wide_int *);
|
||||
extern void set_nonzero_bits (tree, const wide_int_ref &);
|
||||
extern wide_int get_nonzero_bits (const_tree);
|
||||
|
@ -97,7 +97,7 @@ extern bool get_ptr_nonnull (const_tree);
|
|||
extern tree copy_ssa_name_fn (struct function *, tree, gimple *);
|
||||
extern void duplicate_ssa_name_ptr_info (tree, struct ptr_info_def *);
|
||||
extern tree duplicate_ssa_name_fn (struct function *, tree, gimple *);
|
||||
extern void duplicate_ssa_name_range_info (tree, enum value_range_type,
|
||||
extern void duplicate_ssa_name_range_info (tree, enum value_range_kind,
|
||||
struct range_info_def *);
|
||||
extern void reset_flow_sensitive_info (tree);
|
||||
extern void reset_flow_sensitive_info_in_bb (basic_block);
|
||||
|
|
|
@ -53,7 +53,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
static bool
|
||||
vect_get_range_info (tree var, wide_int *min_value, wide_int *max_value)
|
||||
{
|
||||
value_range_type vr_type = get_range_info (var, min_value, max_value);
|
||||
value_range_kind vr_type = get_range_info (var, min_value, max_value);
|
||||
wide_int nonzero = get_nonzero_bits (var);
|
||||
signop sgn = TYPE_SIGN (TREE_TYPE (var));
|
||||
if (intersect_range_with_nonzero_bits (vr_type, min_value, max_value,
|
||||
|
|
1032
gcc/tree-vrp.c
1032
gcc/tree-vrp.c
File diff suppressed because it is too large
Load Diff
160
gcc/tree-vrp.h
160
gcc/tree-vrp.h
|
@ -20,42 +20,143 @@ along with GCC; see the file COPYING3. If not see
|
|||
#ifndef GCC_TREE_VRP_H
|
||||
#define GCC_TREE_VRP_H
|
||||
|
||||
/* Type of value ranges. See value_range below for a
|
||||
description of these types. */
|
||||
enum value_range_type { VR_UNDEFINED, VR_RANGE,
|
||||
VR_ANTI_RANGE, VR_VARYING, VR_LAST };
|
||||
/* Types of value ranges. */
|
||||
enum value_range_kind
|
||||
{
|
||||
/* Empty range. */
|
||||
VR_UNDEFINED,
|
||||
/* Range spans the entire domain. */
|
||||
VR_VARYING,
|
||||
/* Range is [MIN, MAX]. */
|
||||
VR_RANGE,
|
||||
/* Range is ~[MIN, MAX]. */
|
||||
VR_ANTI_RANGE,
|
||||
/* Range is a nice guy. */
|
||||
VR_LAST
|
||||
};
|
||||
|
||||
/* Range of values that can be associated with an SSA_NAME after VRP
|
||||
has executed. */
|
||||
struct GTY((for_user)) value_range
|
||||
class GTY((for_user)) value_range
|
||||
{
|
||||
/* Lattice value represented by this range. */
|
||||
enum value_range_type type;
|
||||
public:
|
||||
value_range ();
|
||||
value_range (value_range_kind, tree, tree, bitmap = NULL);
|
||||
void update (value_range_kind, tree, tree);
|
||||
bool operator== (const value_range &) const;
|
||||
bool operator!= (const value_range &) const;
|
||||
void intersect (const value_range *);
|
||||
void union_ (const value_range *);
|
||||
|
||||
/* Minimum and maximum values represented by this range. These
|
||||
values should be interpreted as follows:
|
||||
/* Types of value ranges. */
|
||||
bool undefined_p () const;
|
||||
bool varying_p () const;
|
||||
bool symbolic_p () const;
|
||||
bool constant_p () const;
|
||||
void set_undefined ();
|
||||
void set_varying ();
|
||||
|
||||
- If TYPE is VR_UNDEFINED or VR_VARYING then MIN and MAX must
|
||||
be NULL.
|
||||
/* Equivalence bitmap methods. */
|
||||
bitmap equiv () const;
|
||||
void equiv_clear ();
|
||||
void equiv_add (const_tree, const value_range *, bitmap_obstack * = NULL);
|
||||
|
||||
- If TYPE == VR_RANGE then MIN holds the minimum value and
|
||||
MAX holds the maximum value of the range [MIN, MAX].
|
||||
/* Misc methods. */
|
||||
tree type () const;
|
||||
bool null_p () const;
|
||||
bool may_contain_p (tree) const;
|
||||
bool singleton_p (tree *result = NULL) const;
|
||||
void deep_copy (const value_range *);
|
||||
bool ignore_equivs_equal_p (const value_range &) const;
|
||||
void set_and_canonicalize (enum value_range_kind, tree, tree, bitmap);
|
||||
void dump (FILE *) const;
|
||||
void dump () const;
|
||||
|
||||
- If TYPE == ANTI_RANGE the variable is known to NOT
|
||||
take any values in the range [MIN, MAX]. */
|
||||
tree min;
|
||||
tree max;
|
||||
enum value_range_kind kind () const;
|
||||
tree min () const;
|
||||
tree max () const;
|
||||
|
||||
private:
|
||||
void set (value_range_kind, tree, tree, bitmap);
|
||||
void check ();
|
||||
bool equal_p (const value_range &, bool ignore_equivs) const;
|
||||
void intersect_helper (value_range *, const value_range *);
|
||||
void union_helper (value_range *, const value_range *);
|
||||
|
||||
enum value_range_kind m_kind;
|
||||
public:
|
||||
/* These should be private, but GTY is a piece of crap. */
|
||||
tree m_min;
|
||||
tree m_max;
|
||||
/* Set of SSA names whose value ranges are equivalent to this one.
|
||||
This set is only valid when TYPE is VR_RANGE or VR_ANTI_RANGE. */
|
||||
bitmap equiv;
|
||||
|
||||
/* Dump value range to stderr. */
|
||||
void dump () const;
|
||||
bitmap m_equiv;
|
||||
};
|
||||
|
||||
extern void vrp_intersect_ranges (value_range *vr0, const value_range *vr1);
|
||||
extern void vrp_meet (value_range *vr0, const value_range *vr1);
|
||||
inline
|
||||
value_range::value_range ()
|
||||
{
|
||||
m_kind = VR_UNDEFINED;
|
||||
m_min = m_max = NULL;
|
||||
m_equiv = NULL;
|
||||
}
|
||||
|
||||
/* Return the kind of this range. */
|
||||
|
||||
inline value_range_kind
|
||||
value_range::kind () const
|
||||
{
|
||||
return m_kind;
|
||||
}
|
||||
|
||||
inline bitmap
|
||||
value_range::equiv () const
|
||||
{
|
||||
return m_equiv;
|
||||
}
|
||||
|
||||
/* Return the lower bound. */
|
||||
|
||||
inline tree
|
||||
value_range::min () const
|
||||
{
|
||||
return m_min;
|
||||
}
|
||||
|
||||
/* Return the upper bound. */
|
||||
|
||||
inline tree
|
||||
value_range::max () const
|
||||
{
|
||||
return m_max;
|
||||
}
|
||||
|
||||
/* Return TRUE if range spans the entire possible domain. */
|
||||
|
||||
inline bool
|
||||
value_range::varying_p () const
|
||||
{
|
||||
return m_kind == VR_VARYING;
|
||||
}
|
||||
|
||||
/* Return TRUE if range is undefined (essentially the empty set). */
|
||||
|
||||
inline bool
|
||||
value_range::undefined_p () const
|
||||
{
|
||||
return m_kind == VR_UNDEFINED;
|
||||
}
|
||||
|
||||
/* Return TRUE if range is the constant zero. */
|
||||
|
||||
inline bool
|
||||
value_range::null_p () const
|
||||
{
|
||||
return (m_kind == VR_RANGE
|
||||
&& integer_zerop (m_min)
|
||||
&& integer_zerop (m_max));
|
||||
}
|
||||
|
||||
extern void dump_value_range (FILE *, const value_range *);
|
||||
extern void extract_range_from_unary_expr (value_range *vr,
|
||||
enum tree_code code,
|
||||
|
@ -64,8 +165,8 @@ extern void extract_range_from_unary_expr (value_range *vr,
|
|||
tree op0_type);
|
||||
|
||||
extern bool vrp_operand_equal_p (const_tree, const_tree);
|
||||
extern enum value_range_type intersect_range_with_nonzero_bits
|
||||
(enum value_range_type, wide_int *, wide_int *, const wide_int &, signop);
|
||||
extern enum value_range_kind intersect_range_with_nonzero_bits
|
||||
(enum value_range_kind, wide_int *, wide_int *, const wide_int &, signop);
|
||||
|
||||
struct assert_info
|
||||
{
|
||||
|
@ -90,19 +191,14 @@ extern bool range_includes_zero_p (const value_range *);
|
|||
extern bool infer_value_range (gimple *, tree, tree_code *, tree *);
|
||||
|
||||
extern void set_value_range_to_nonnull (value_range *, tree);
|
||||
extern void set_value_range (value_range *, enum value_range_type, tree,
|
||||
extern void set_value_range (value_range *, enum value_range_kind, tree,
|
||||
tree, bitmap);
|
||||
extern void set_and_canonicalize_value_range (value_range *,
|
||||
enum value_range_type,
|
||||
tree, tree, bitmap);
|
||||
extern bool vrp_bitmap_equal_p (const_bitmap, const_bitmap);
|
||||
extern tree value_range_constant_singleton (const value_range *);
|
||||
extern bool symbolic_range_p (const value_range *);
|
||||
extern int compare_values (tree, tree);
|
||||
extern int compare_values_warnv (tree, tree, bool *);
|
||||
extern bool vrp_val_is_min (const_tree);
|
||||
extern bool vrp_val_is_max (const_tree);
|
||||
extern void copy_value_range (value_range *, const value_range *);
|
||||
extern void set_value_range_to_value (value_range *, tree, bitmap);
|
||||
extern void extract_range_from_binary_expr_1 (value_range *, enum tree_code,
|
||||
tree, const value_range *,
|
||||
|
@ -121,5 +217,5 @@ extern bool range_int_cst_singleton_p (const value_range *);
|
|||
extern int value_inside_range (tree, tree, tree);
|
||||
extern tree get_single_symbol (tree, bool *, tree *);
|
||||
extern void maybe_set_nonzero_bits (edge, tree);
|
||||
extern value_range_type determine_value_range (tree, wide_int *, wide_int *);
|
||||
extern value_range_kind determine_value_range (tree, wide_int *, wide_int *);
|
||||
#endif /* GCC_TREE_VRP_H */
|
||||
|
|
638
gcc/vr-values.c
638
gcc/vr-values.c
File diff suppressed because it is too large
Load Diff
|
@ -72,7 +72,6 @@ class vr_values
|
|||
void cleanup_edges_and_switches (void);
|
||||
|
||||
private:
|
||||
void add_equivalence (bitmap *, const_tree);
|
||||
bool vrp_stmt_computes_nonzero (gimple *);
|
||||
bool op_with_boolean_value_range_p (tree);
|
||||
bool check_for_binary_op_overflow (enum tree_code, tree, tree, tree, bool *);
|
||||
|
@ -142,7 +141,5 @@ class vr_values
|
|||
vec<switch_update> to_update_switch_stmts;
|
||||
};
|
||||
|
||||
#define VR_INITIALIZER { VR_UNDEFINED, NULL_TREE, NULL_TREE, NULL }
|
||||
|
||||
extern tree get_output_for_vrp (gimple *);
|
||||
#endif /* GCC_VR_VALUES_H */
|
||||
|
|
Loading…
Reference in New Issue