This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA][PATCH] 11/n More VRP related cleanups


On Sat, Nov 18, 2017 at 9:49 AM, Jeff Law <law@redhat.com> wrote:
>
> Not as extensive as the last set.  Just getting a couple data members
> privatized as well as one method within vr_values.
>
> I'd really like to just get values_propagated out of vr_values and bury
> it in tree-vrp.c, but we're not to that point yet.
>
> Bootstrapped and regression tested on x86.
>
> OK for the trunk?

Ok.

Richard.

> jeff
>
>
>         * 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.
>
>
>
> 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 e248f59a67f..838822d82f6 100644
> --- a/gcc/tree-vrp.c
> +++ b/gcc/tree-vrp.c
> @@ -6572,14 +6572,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;
>         }
> @@ -6747,7 +6750,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<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;
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]