From: Jeff Law Date: Thu, 23 Nov 2017 00:04:07 +0000 (-0700) Subject: gimple-ssa-evrp-analyze.c (evrp_range_analyzer::try_find_new_range): Use new method... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3e406d3330ca865244cd867572cdd02627a8757a;p=gcc.git gimple-ssa-evrp-analyze.c (evrp_range_analyzer::try_find_new_range): Use new method allocate_value_range rather than accessing the... * gimple-ssa-evrp-analyze.c (evrp_range_analyzer::try_find_new_range): Use new method allocate_value_range rather than accessing the vrp_value_range_pool data member directly. * tree-vrp.c (simplify_stmt_for_jump_threading): Tweak slightly to use extract_range_from_stmt method to avoid need for extract_range_from_assignment method. (vrp_prop::vrp_finalize): Use set_lattice_propagation_complete method rather than setting values_propgated data member directly. * vr-values.h (class vr_values): Privatize vrp_value_range_pool, and values propagated data members and extract_range_from_assignment method. Reorder private data members to conform to standards. Add new methods set_lattice_propagation_complete and allocate_value_range. From-SVN: r255086 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ac96304935a..8d5ee90ab02 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2017-11-22 Jeff Law + + * gimple-ssa-evrp-analyze.c (evrp_range_analyzer::try_find_new_range): + Use new method allocate_value_range rather than accessing the + vrp_value_range_pool data member directly. + * tree-vrp.c (simplify_stmt_for_jump_threading): Tweak slightly + to use extract_range_from_stmt method to avoid need for + extract_range_from_assignment method. + (vrp_prop::vrp_finalize): Use set_lattice_propagation_complete + method rather than setting values_propgated data member directly. + * vr-values.h (class vr_values): Privatize vrp_value_range_pool, + and values propagated data members and extract_range_from_assignment + method. Reorder private data members to conform to standards. + Add new methods set_lattice_propagation_complete and + allocate_value_range. + 2017-11-22 Eric Botcazou PR rtl-optimization/83030 diff --git a/gcc/gimple-ssa-evrp-analyze.c b/gcc/gimple-ssa-evrp-analyze.c index c3877791a5e..cfaf18feecb 100644 --- a/gcc/gimple-ssa-evrp-analyze.c +++ b/gcc/gimple-ssa-evrp-analyze.c @@ -84,7 +84,7 @@ evrp_range_analyzer::try_find_new_range (tree name, && 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->vrp_value_range_pool.allocate (); + value_range *new_vr = vr_values->allocate_value_range (); *new_vr = vr; return new_vr; } diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index ea56e9d0d2d..5f9baa3e7ff 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -6580,14 +6580,17 @@ simplify_stmt_for_jump_threading (gimple *stmt, gimple *within_stmt, if (gassign *assign_stmt = dyn_cast (stmt)) { - value_range new_vr = VR_INITIALIZER; tree lhs = gimple_assign_lhs (assign_stmt); - if (TREE_CODE (lhs) == SSA_NAME && (INTEGRAL_TYPE_P (TREE_TYPE (lhs)) - || POINTER_TYPE_P (TREE_TYPE (lhs)))) + || POINTER_TYPE_P (TREE_TYPE (lhs))) + && stmt_interesting_for_vrp (stmt)) { - vr_values->extract_range_from_assignment (&new_vr, assign_stmt); + edge dummy_e; + tree dummy_tree; + value_range new_vr = VR_INITIALIZER; + 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; } @@ -6755,7 +6758,8 @@ vrp_prop::vrp_finalize (bool warn_array_bounds_p) { size_t i; - vr_values.values_propagated = true; + /* We have completed propagating through the lattice. */ + vr_values.set_lattice_propagation_complete (); if (dump_file) { diff --git a/gcc/vr-values.h b/gcc/vr-values.h index 9eeebedfaed..124ee6f4356 100644 --- a/gcc/vr-values.h +++ b/gcc/vr-values.h @@ -54,7 +54,6 @@ class vr_values tree, tree, value_range *); void extract_range_from_phi_node (gphi *, value_range *); void extract_range_basic (value_range *, gimple *); - void extract_range_from_assignment (value_range *, gassign *); void extract_range_from_stmt (gimple *, edge *, tree *, value_range *); void vrp_visit_cond_stmt (gcond *, edge *); @@ -62,14 +61,14 @@ class vr_values void simplify_cond_using_ranges_2 (gcond *); bool simplify_stmt_using_ranges (gimple_stmt_iterator *); - /* This probably belongs in the lattice rather than in here. */ - bool values_propagated; + /* Indicate that propagation through the lattice is complete. */ + void set_lattice_propagation_complete (void) { values_propagated = true; } - /* Allocation pools for tree-vrp allocations. */ - object_allocator vrp_value_range_pool; + /* Allocate a new value_range object. */ + value_range *allocate_value_range (void) + { return vrp_value_range_pool.allocate (); } private: - bitmap_obstack vrp_equiv_obstack; void add_equivalence (bitmap *, const_tree); bool vrp_stmt_computes_nonzero (gimple *); bool op_with_boolean_value_range_p (tree); @@ -84,6 +83,7 @@ class vr_values tree vrp_evaluate_conditional_warnv_with_ops (enum tree_code, tree, tree, bool, bool *, bool *); + void extract_range_from_assignment (value_range *, gassign *); void extract_range_from_assert (value_range *, tree); void extract_range_from_ssa_name (value_range *, tree); void extract_range_from_binary_expr (value_range *, enum tree_code, @@ -106,6 +106,15 @@ class vr_values gimple *); bool simplify_internal_call_using_ranges (gimple_stmt_iterator *, gimple *); + /* Allocation pools for value_range objects. */ + object_allocator vrp_value_range_pool; + + /* This probably belongs in the lattice rather than in here. */ + bool values_propagated; + + /* Allocations for equivalences all come from this obstack. */ + bitmap_obstack vrp_equiv_obstack; + /* Value range array. After propagation, VR_VALUE[I] holds the range of values that SSA name N_I may take. */ unsigned int num_vr_values;