aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2018-09-21 14:00:23 -0600
committerJeff Law <law@gcc.gnu.org>2018-09-21 14:00:23 -0600
commit35b66f30438dfac74e4bdcfc7904e9b9cf72b823 (patch)
treecd47b72ecf0d3f7885412cc2133a0bda575ffb65 /gcc/tree-vrp.c
parent2e3f6531bfb5a880d88ec592de944a329aaef18a (diff)
downloadgcc-35b66f30438dfac74e4bdcfc7904e9b9cf72b823.zip
gcc-35b66f30438dfac74e4bdcfc7904e9b9cf72b823.tar.gz
gcc-35b66f30438dfac74e4bdcfc7904e9b9cf72b823.tar.bz2
gimple-ssa-evrp.c (evrp_dom_walker::cleanup): Call vr_values::cleanup_edges_and_switches.
* gimple-ssa-evrp.c (evrp_dom_walker::cleanup): Call vr_values::cleanup_edges_and_switches. * tree-vrp.c (to_remove_edges, to_update_switch_stmts): Moved into vr_values class. (identify_jump_threads): Remove EDGE_IGNORE handling. (execute_vrp): Move handling of to_remove_edges and to_update_switch_stmts into vr_values class member functions. * tree-vrp.h (switch_update, to_remove_edges): Remove declarations. (to_update_switch_stmts): Likewise. * vr-values.c: Include cfghooks.h. (vr_values::vr_values): Initialize to_remove_edges and to_update_switch_stmts. (vr_values::~vr_values): Verify to_remove_edges and to_update_switch_stmts are empty. (vr_values::simplify_switch_using_ranges): Set EDGE_IGNORE as needed. (vr_values::cleanup_edges_and_switches): New member function. * vr-values.h (vr_values): Add cleanup_edges_and_switches member function. Add new data members. * gcc.dg/tree-ssa/vrp113.c: Disable EVRP. * gcc.dg/tree-ssa/vrp120.c: New test. From-SVN: r264491
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r--gcc/tree-vrp.c51
1 files changed, 1 insertions, 50 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 622ccbc..ab222a3 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -121,10 +121,6 @@ static bitmap need_assert_for;
ASSERT_EXPRs for SSA name N_I should be inserted. */
static assert_locus **asserts_for;
-vec<edge> to_remove_edges;
-vec<switch_update> to_update_switch_stmts;
-
-
/* Return the maximum value for TYPE. */
tree
@@ -6404,9 +6400,6 @@ vrp_dom_walker::after_dom_children (basic_block bb)
static void
identify_jump_threads (class vr_values *vr_values)
{
- int i;
- edge e;
-
/* Ugh. When substituting values earlier in this pass we can
wipe the dominance information. So rebuild the dominator
information as we need it within the jump threading code. */
@@ -6419,11 +6412,6 @@ identify_jump_threads (class vr_values *vr_values)
recompute it. */
mark_dfs_back_edges ();
- /* Do not thread across edges we are about to remove. Just marking
- them as EDGE_IGNORE will do. */
- FOR_EACH_VEC_ELT (to_remove_edges, i, e)
- e->flags |= EDGE_IGNORE;
-
/* Allocate our unwinder stack to unwind any temporary equivalences
that might be recorded. */
const_and_copies *equiv_stack = new const_and_copies ();
@@ -6437,10 +6425,6 @@ identify_jump_threads (class vr_values *vr_values)
walker.vr_values = vr_values;
walker.walk (cfun->cfg->x_entry_block_ptr);
- /* Clear EDGE_IGNORE. */
- FOR_EACH_VEC_ELT (to_remove_edges, i, e)
- e->flags &= ~EDGE_IGNORE;
-
/* We do not actually update the CFG or SSA graphs at this point as
ASSERT_EXPRs are still in the IL and cfg cleanup code does not yet
handle ASSERT_EXPRs gracefully. */
@@ -6557,9 +6541,6 @@ vrp_prop::vrp_finalize (bool warn_array_bounds_p)
static unsigned int
execute_vrp (bool warn_array_bounds_p)
{
- int i;
- edge e;
- switch_update *su;
loop_optimizer_init (LOOPS_NORMAL | LOOPS_HAVE_RECORDED_EXITS);
rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
@@ -6570,8 +6551,6 @@ execute_vrp (bool warn_array_bounds_p)
EDGE_DFS_BACK. */
insert_range_assertions ();
- to_remove_edges.create (10);
- to_update_switch_stmts.create (5);
threadedge_initialize_values ();
/* For visiting PHI nodes we need EDGE_DFS_BACK computed. */
@@ -6623,35 +6602,7 @@ execute_vrp (bool warn_array_bounds_p)
processing by the pass manager. */
thread_through_all_blocks (false);
- /* Remove dead edges from SWITCH_EXPR optimization. This leaves the
- CFG in a broken state and requires a cfg_cleanup run. */
- FOR_EACH_VEC_ELT (to_remove_edges, i, e)
- remove_edge (e);
- /* Update SWITCH_EXPR case label vector. */
- FOR_EACH_VEC_ELT (to_update_switch_stmts, i, su)
- {
- size_t j;
- size_t n = TREE_VEC_LENGTH (su->vec);
- tree label;
- gimple_switch_set_num_labels (su->stmt, n);
- for (j = 0; j < n; j++)
- gimple_switch_set_label (su->stmt, j, TREE_VEC_ELT (su->vec, j));
- /* As we may have replaced the default label with a regular one
- make sure to make it a real default label again. This ensures
- optimal expansion. */
- label = gimple_switch_label (su->stmt, 0);
- CASE_LOW (label) = NULL_TREE;
- CASE_HIGH (label) = NULL_TREE;
- }
-
- if (to_remove_edges.length () > 0)
- {
- free_dominance_info (CDI_DOMINATORS);
- loops_state_set (LOOPS_NEED_FIXUP);
- }
-
- to_remove_edges.release ();
- to_update_switch_stmts.release ();
+ vrp_prop.vr_values.cleanup_edges_and_switches ();
threadedge_finalize_values ();
scev_finalize ();