This ensures the vector gets cleaned up by the caller when appropriate.
Signed-off-by: Trevor Saunders <tbsaunde@tbsaunde.org>
gcc/ChangeLog:
* dominance.c (get_dominated_to_depth): Return auto_vec<basic_block>.
* dominance.h (get_dominated_to_depth): Likewise.
(get_all_dominated_blocks): Likewise.
* cfgcleanup.c (delete_unreachable_blocks): Adjust.
* gcse.c (hoist_code): Likewise.
* tree-cfg.c (remove_edge_and_dominated_blocks): Likewise.
* tree-parloops.c (oacc_entry_exit_ok): Likewise.
* tree-ssa-dce.c (eliminate_unnecessary_stmts): Likewise.
* tree-ssa-phiprop.c (pass_phiprop::execute): Likewise.
delete_basic_block (b);
else
{
- vec<basic_block> h
+ auto_vec<basic_block> h
= get_all_dominated_blocks (CDI_DOMINATORS, b);
while (h.length ())
delete_basic_block (b);
}
-
- h.release ();
}
changed = true;
produce a vector containing all dominated blocks. The vector will be sorted
in preorder. */
-vec<basic_block>
+auto_vec<basic_block>
get_dominated_to_depth (enum cdi_direction dir, basic_block bb, int depth)
{
- vec<basic_block> bbs = vNULL;
+ auto_vec<basic_block> bbs;
unsigned i;
unsigned next_level_start;
/* Returns the list of basic blocks including BB dominated by BB, in the
direction DIR. The vector will be sorted in preorder. */
-vec<basic_block>
+auto_vec<basic_block>
get_all_dominated_blocks (enum cdi_direction dir, basic_block bb)
{
return get_dominated_to_depth (dir, bb, 0);
extern auto_vec<basic_block> get_dominated_by_region (enum cdi_direction,
basic_block *,
unsigned);
-extern vec<basic_block> get_dominated_to_depth (enum cdi_direction,
- basic_block, int);
-extern vec<basic_block> get_all_dominated_blocks (enum cdi_direction,
- basic_block);
+extern auto_vec<basic_block> get_dominated_to_depth (enum cdi_direction,
+ basic_block, int);
+extern auto_vec<basic_block> get_all_dominated_blocks (enum cdi_direction,
+ basic_block);
extern void redirect_immediate_dominators (enum cdi_direction, basic_block,
basic_block);
extern basic_block nearest_common_dominator (enum cdi_direction,
hoist_code (void)
{
basic_block bb, dominated;
- vec<basic_block> dom_tree_walk;
unsigned int dom_tree_walk_index;
- vec<basic_block> domby;
unsigned int i, j, k;
struct gcse_expr **index_map;
struct gcse_expr *expr;
if (flag_ira_hoist_pressure)
hoisted_bbs = BITMAP_ALLOC (NULL);
- dom_tree_walk = get_all_dominated_blocks (CDI_DOMINATORS,
- ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb);
+ auto_vec<basic_block> dom_tree_walk
+ = get_all_dominated_blocks (CDI_DOMINATORS,
+ ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb);
/* Walk over each basic block looking for potentially hoistable
expressions, nothing gets hoisted from the entry block. */
FOR_EACH_VEC_ELT (dom_tree_walk, dom_tree_walk_index, bb)
{
- domby = get_dominated_to_depth (CDI_DOMINATORS, bb,
- param_max_hoist_depth);
+ auto_vec<basic_block> domby
+ = get_dominated_to_depth (CDI_DOMINATORS, bb, param_max_hoist_depth);
if (domby.length () == 0)
continue;
bitmap_clear (from_bbs);
}
}
- domby.release ();
}
- dom_tree_walk.release ();
BITMAP_FREE (from_bbs);
if (flag_ira_hoist_pressure)
BITMAP_FREE (hoisted_bbs);
void
remove_edge_and_dominated_blocks (edge e)
{
- vec<basic_block> bbs_to_remove = vNULL;
vec<basic_block> bbs_to_fix_dom = vNULL;
edge f;
edge_iterator ei;
}
auto_bitmap df, df_idom;
+ auto_vec<basic_block> bbs_to_remove;
if (none_removed)
bitmap_set_bit (df_idom,
get_immediate_dominator (CDI_DOMINATORS, e->dest)->index);
iterate_fix_dominators (CDI_DOMINATORS, bbs_to_fix_dom, true);
- bbs_to_remove.release ();
bbs_to_fix_dom.release ();
}
reduction_info_table_type *reduction_list)
{
basic_block *loop_bbs = get_loop_body_in_dom_order (loop);
- vec<basic_block> region_bbs
+ auto_vec<basic_block> region_bbs
= get_all_dominated_blocks (CDI_DOMINATORS, ENTRY_BLOCK_PTR_FOR_FN (cfun));
bitmap in_loop_bbs = BITMAP_ALLOC (NULL);
}
}
- region_bbs.release ();
free (loop_bbs);
BITMAP_FREE (in_loop_bbs);
gimple_stmt_iterator gsi, psi;
gimple *stmt;
tree call;
- vec<basic_block> h;
auto_vec<edge> to_remove_edges;
if (dump_file && (dump_flags & TDF_DETAILS))
as desired. */
gcc_assert (dom_info_available_p (CDI_DOMINATORS));
+ auto_vec<basic_block> h;
h = get_all_dominated_blocks (CDI_DOMINATORS,
single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)));
something_changed |= remove_dead_phis (bb);
}
- h.release ();
/* Since we don't track liveness of virtual PHI nodes, it is possible that we
rendered some PHI nodes unreachable while they are still in use.
unsigned int
pass_phiprop::execute (function *fun)
{
- vec<basic_block> bbs;
struct phiprop_d *phivn;
bool did_something = false;
basic_block bb;
phivn = XCNEWVEC (struct phiprop_d, n);
/* Walk the dominator tree in preorder. */
- bbs = get_all_dominated_blocks (CDI_DOMINATORS,
- single_succ (ENTRY_BLOCK_PTR_FOR_FN (fun)));
+ auto_vec<basic_block> bbs
+ = get_all_dominated_blocks (CDI_DOMINATORS,
+ single_succ (ENTRY_BLOCK_PTR_FOR_FN (fun)));
FOR_EACH_VEC_ELT (bbs, i, bb)
{
/* Since we're going to move dereferences across predecessor
if (did_something)
gsi_commit_edge_inserts ();
- bbs.release ();
free (phivn);
free_dominance_info (CDI_POST_DOMINATORS);