Hi Andrew,
Why separate out early VRP from tree-vrp? Just a little curious.
It is based on the discussion in https://gcc.gnu.org/ml/gcc/2016-01/msg00069.html. In summary, conclusion (based on my understanding) was to implement a simplified VRP algorithm that doesn't require ASSERT_EXPR insertion.
Also it seems like if you are going to do that, putting the following functions in a class would be better: +extern void vrp_initialize (void); +extern void vrp_finalize (bool update, bool warn_array_bounds_p); +extern void vrp_intersect_ranges (value_range *vr0, value_range *vr1); +extern void vrp_meet (value_range *vr0, value_range *vr1); +extern enum ssa_prop_result vrp_visit_stmt (gimple *stmt, + edge *taken_edge_p, + tree *output_p); +extern enum ssa_prop_result vrp_visit_phi_node (gphi *phi); +extern bool stmt_interesting_for_vrp (gimple *stmt); + +extern void extract_range_from_assert (value_range *vr_p, tree expr); +extern bool update_value_range (const_tree var, value_range *vr); +extern value_range *get_value_range (const_tree var); +extern void set_value_range (value_range *vr, enum value_range_type t, + tree min, tree max, bitmap equiv); +extern void change_value_range (const_tree var, value_range *new_vr); + +extern void dump_value_range (FILE *, value_range *); That is vrp_initialize becomes the constructor and vrp_finalize becomes the deconstructor. With both jump_thread and warn_array_bounds_p being variables you set while running your pass.
I will give this a try. Thanks, Kugan