diff options
Diffstat (limited to 'gcc/tree-ssa-loop-im.c')
-rw-r--r-- | gcc/tree-ssa-loop-im.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index e1b22de..ec0fb7f 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -1112,15 +1112,16 @@ public: data stored in LIM_DATA structures associated with each statement. Callback for walk_dominator_tree. */ -edge -move_computations_dom_walker::before_dom_children (basic_block bb) +unsigned int +move_computations_worker (basic_block bb) { struct loop *level; unsigned cost = 0; struct lim_aux_data *lim_data; + unsigned int todo = 0; if (!loop_outer (bb->loop_father)) - return NULL; + return todo; for (gphi_iterator bsi = gsi_start_phis (bb); !gsi_end_p (bsi); ) { @@ -1171,7 +1172,7 @@ move_computations_dom_walker::before_dom_children (basic_block bb) gimple_cond_lhs (cond), gimple_cond_rhs (cond)); new_stmt = gimple_build_assign (gimple_phi_result (stmt), COND_EXPR, t, arg0, arg1); - todo_ |= TODO_cleanup_cfg; + todo |= TODO_cleanup_cfg; } if (INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_lhs (new_stmt))) && (!ALWAYS_EXECUTED_IN (bb) @@ -1266,7 +1267,8 @@ move_computations_dom_walker::before_dom_children (basic_block bb) else gsi_insert_on_edge (e, stmt); } - return NULL; + + return todo; } /* Hoist the statements out of the loops prescribed by data stored in @@ -1275,14 +1277,20 @@ move_computations_dom_walker::before_dom_children (basic_block bb) static unsigned int move_computations (void) { - move_computations_dom_walker walker (CDI_DOMINATORS); - walker.walk (cfun->cfg->x_entry_block_ptr); + int *rpo = XNEWVEC (int, last_basic_block_for_fn (cfun)); + int n = pre_and_rev_post_order_compute_fn (cfun, NULL, rpo, false); + unsigned todo = 0; + + for (int i = 0; i < n; ++i) + todo |= move_computations_worker (BASIC_BLOCK_FOR_FN (cfun, rpo[i])); + + free (rpo); gsi_commit_edge_inserts (); if (need_ssa_update_p (cfun)) rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa); - return walker.todo_; + return todo; } /* Checks whether the statement defining variable *INDEX can be hoisted |