This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] Small cleanup for dominator optimizers
- From: Steven Bosscher <s dot bosscher at student dot tudelft dot nl>
- To: gcc-patches at gcc dot gnu dot org
- Date: 23 Jul 2003 11:36:14 +0200
- Subject: [tree-ssa] Small cleanup for dominator optimizers
If we're going to iterate a few times in the dominator optimizers, then
creating/deleting the hash table should be done outside the loop. OK?
Gr.
Steven
2003-07-23 Steven Bosscher <steven@gcc.gnu.org>
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Make
found_unreachable a bool. Create/delete hash tables for
copies and available exprs outside the main loop. Use
htab_clean to whipe them after each iteration.
Index: tree-ssa-dom.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-dom.c,v
retrieving revision 1.1.2.8
diff -c -3 -p -r1.1.2.8 tree-ssa-dom.c
*** tree-ssa-dom.c 22 Jul 2003 02:50:15 -0000 1.1.2.8
--- tree-ssa-dom.c 23 Jul 2003 08:55:58 -0000
*************** static void htab_statistics (FILE *, hta
*** 107,113 ****
bool
tree_ssa_dominator_optimize (tree fndecl)
{
! int found_unreachable;
bitmap unreachable_bitmap = BITMAP_XMALLOC ();
timevar_push (TV_TREE_SSA_DOMINATOR_OPTS);
--- 107,113 ----
bool
tree_ssa_dominator_optimize (tree fndecl)
{
! bool found_unreachable;
bitmap unreachable_bitmap = BITMAP_XMALLOC ();
timevar_push (TV_TREE_SSA_DOMINATOR_OPTS);
*************** tree_ssa_dominator_optimize (tree fndecl
*** 115,120 ****
--- 115,124 ----
/* Set up debugging dump files. */
dump_file = dump_begin (TDI_dom, &dump_flags);
+ /* Create our hash tables. */
+ const_and_copies = htab_create (1024, var_value_hash, var_value_eq, free);
+ avail_exprs = htab_create (1024, avail_expr_hash, avail_expr_eq, NULL);
+
/* Indicate that we have not propagated any ADDR_EXPRs. */
addr_expr_propagated_p = false;
*************** tree_ssa_dominator_optimize (tree fndecl
*** 127,142 ****
{
int i;
! /* Create our hash tables. */
! const_and_copies = htab_create (1024, var_value_hash, var_value_eq, free);
! avail_exprs = htab_create (1024, avail_expr_hash, avail_expr_eq, NULL);
!
! /* Now optimize the dominator tree. */
optimize_block (ENTRY_BLOCK_PTR, NULL, 0);
/* Wipe the hash tables. */
! htab_delete (const_and_copies);
! htab_delete (avail_exprs);
/* We may have made some basic blocks unreachable. We do not
want to call tree_cleanup_cfg here as it renumbers the blocks
--- 131,142 ----
{
int i;
! /* Optimize the dominator tree. */
optimize_block (ENTRY_BLOCK_PTR, NULL, 0);
/* Wipe the hash tables. */
! htab_empty (const_and_copies);
! htab_empty (avail_exprs);
/* We may have made some basic blocks unreachable. We do not
want to call tree_cleanup_cfg here as it renumbers the blocks
*************** tree_ssa_dominator_optimize (tree fndecl
*** 147,153 ****
complete removal of the unreachable blocks. */
find_unreachable_blocks ();
! found_unreachable = 0;
for (i = 0; i < n_basic_blocks; i++)
{
--- 147,153 ----
complete removal of the unreachable blocks. */
find_unreachable_blocks ();
! found_unreachable = false;
for (i = 0; i < n_basic_blocks; i++)
{
*************** tree_ssa_dominator_optimize (tree fndecl
*** 160,166 ****
if (bitmap_bit_p (unreachable_bitmap, bb->index))
continue;
! found_unreachable = 1;
bitmap_set_bit (unreachable_bitmap, bb->index);
remove_phi_nodes_and_edges_for_unreachable_block (bb);
}
--- 160,166 ----
if (bitmap_bit_p (unreachable_bitmap, bb->index))
continue;
! found_unreachable = true;
bitmap_set_bit (unreachable_bitmap, bb->index);
remove_phi_nodes_and_edges_for_unreachable_block (bb);
}
*************** tree_ssa_dominator_optimize (tree fndecl
*** 168,173 ****
--- 168,175 ----
}
while (found_unreachable);
+ htab_delete (const_and_copies);
+ htab_delete (avail_exprs);
BITMAP_XFREE (unreachable_bitmap);
/* Debugging dumps. */