summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dom.c
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2020-06-18 10:37:14 +0200
committerAldy Hernandez <aldyh@redhat.com>2020-06-27 14:11:41 +0200
commitfc36b97af05ef74b0889ba49090c2f52f00e0e77 (patch)
tree56791637843a2bcbb21cd928008a014f163e7a12 /gcc/tree-ssa-dom.c
parentaed3ab253dada2b7d2ed63cc6a8e15e263d5dd35 (diff)
Move simplification of statements using ranges into its own class.
This moves all the simplification code from vr_values into a separate class (simplify_using_ranges). In doing so, we get rid of a bunch of dependencies on the internals of vr_values. The goal is to (a) remove unnecessary interdependendcies (b) be able to use this engine with any range infrastructure, as all it needs is a method to get the range for an SSA name (get_value_range). I also removed as many dependencies on value_range_equiv as possible, preferring value_range. A few value_range_equiv uses remain, but for cases where equivalences are actually used (folding conditionals, etc). gcc/ChangeLog: * gimple-ssa-evrp-analyze.h (vrp_visit_cond_stmt): Use simplify_using_ranges class. * gimple-ssa-evrp.c (class evrp_folder): New simplify_using_ranges field. Adjust all methods to use new field. * tree-ssa-dom.c (simplify_stmt_for_jump_threading): Use simplify_using_ranges class. * tree-vrp.c (class vrp_folder): New simplify_using_ranges field. Adjust all methods to use new field. (simplify_stmt_for_jump_threading): Use simplify_using_ranges class. (vrp_prop::vrp_finalize): New vrp_folder argument. (execute_vrp): Pass folder to vrp_finalize. Use simplify_using_ranges class. Remove cleanup_edges_and_switches call. * vr-values.c (vr_values::op_with_boolean_value_range_p): Change value_range_equiv uses to value_range. (simplify_using_ranges::op_with_boolean_value_range_p): Use simplify_using_ranges class. (check_for_binary_op_overflow): Make static. (vr_values::extract_range_basic): Pass this to check_for_binary_op_overflow. (compare_range_with_value): Change value_range_equiv uses to value_range. (vr_values::vr_values): Initialize simplifier field. Remove uses of to_remove_edges and to_update_switch_stmts. (vr_values::~vr_values): Remove uses of to_remove_edges and to_update_switch_stmts. (vr_values::get_vr_for_comparison): Move to simplify_using_ranges class. (vr_values::compare_name_with_value): Same. (vr_values::compare_names): Same. (vr_values::vrp_evaluate_conditional_warnv_with_ops): Same. (vr_values::vrp_evaluate_conditional): Same. (vr_values::vrp_visit_cond_stmt): Same. (find_case_label_ranges): Change value_range_equiv uses to value_range. (vr_values::extract_range_from_stmt): Use simplify_using_ranges class. (vr_values::simplify_truth_ops_using_ranges): Move to simplify_using_ranges class. (vr_values::simplify_div_or_mod_using_ranges): Same. (vr_values::simplify_min_or_max_using_ranges): Same. (vr_values::simplify_abs_using_ranges): Same. (vr_values::simplify_bit_ops_using_ranges): Same. (test_for_singularity): Change value_range_equiv uses to value_range. (range_fits_type_p): Same. (vr_values::simplify_cond_using_ranges_1): Same. (vr_values::simplify_cond_using_ranges_2): Make extern. (vr_values::fold_cond): Move to simplify_using_ranges class. (vr_values::simplify_switch_using_ranges): Same. (vr_values::cleanup_edges_and_switches): Same. (vr_values::simplify_float_conversion_using_ranges): Same. (vr_values::simplify_internal_call_using_ranges): Same. (vr_values::two_valued_val_range_p): Same. (vr_values::simplify_stmt_using_ranges): Move to... (simplify_using_ranges::simplify): ...here. * vr-values.h (class vr_values): Move all the simplification of statements using ranges methods and code from here... (class simplify_using_ranges): ...to here. (simplify_cond_using_ranges_2): New extern prototype.
Diffstat (limited to 'gcc/tree-ssa-dom.c')
-rw-r--r--gcc/tree-ssa-dom.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 864c984f636..69eaec345bf 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -887,12 +887,11 @@ simplify_stmt_for_jump_threading (gimple *stmt,
copy in tree-vrp is scheduled for removal in gcc-9. */
if (gcond *cond_stmt = dyn_cast <gcond *> (stmt))
{
- cached_lhs
- = x_vr_values->vrp_evaluate_conditional (gimple_cond_code (cond_stmt),
- gimple_cond_lhs (cond_stmt),
- gimple_cond_rhs (cond_stmt),
- within_stmt);
- return cached_lhs;
+ simplify_using_ranges simplifier (x_vr_values);
+ return simplifier.vrp_evaluate_conditional (gimple_cond_code (cond_stmt),
+ gimple_cond_lhs (cond_stmt),
+ gimple_cond_rhs (cond_stmt),
+ within_stmt);
}
if (gswitch *switch_stmt = dyn_cast <gswitch *> (stmt))