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
This commit is contained in:
Jeff Law 2017-11-22 17:04:07 -07:00 committed by Jeff Law
parent d057fdc8e9
commit 3e406d3330
4 changed files with 41 additions and 12 deletions

View file

@ -1,3 +1,19 @@
2017-11-22 Jeff Law <law@redhat.com>
* 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 <ebotcazou@adacore.com>
PR rtl-optimization/83030

View file

@ -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;
}

View file

@ -6580,14 +6580,17 @@ simplify_stmt_for_jump_threading (gimple *stmt, gimple *within_stmt,
if (gassign *assign_stmt = dyn_cast <gassign *> (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)
{

View file

@ -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<value_range> 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<value_range> 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;