This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] One final DCE speedup.
- From: Andrew MacLeod <amacleod at redhat dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: 20 Oct 2003 10:29:46 -0400
- Subject: Re: [tree-ssa] One final DCE speedup.
- References: <1066420361.6885.436.camel@p4> <20031017200516.GF29097@redhat.com>
On Fri, 2003-10-17 at 16:05, Richard Henderson wrote:
> On Fri, Oct 17, 2003 at 03:52:36PM -0400, Andrew MacLeod wrote:
> > + /* vector indicating an SSA name has already been processed and marked
> > + as necessary. */
> > + static bool *processed;
>
> I'd think an sbitmap would take less memory. Which could be
> non-inconsequential in large functions...
>
As per rth's sugggestion.
Andrew
* tree-ssa-dce.c (processed): Change to an sbitmap.
(mark_necessary): Test bits in 'processed'.
(tree_ssa_dce): 'Initialize/free' processed as an sbitmap.
Index: tree-ssa-dce.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-dce.c,v
retrieving revision 1.1.2.60
diff -c -p -r1.1.2.60 tree-ssa-dce.c
*** tree-ssa-dce.c 17 Oct 2003 19:51:49 -0000 1.1.2.60
--- tree-ssa-dce.c 17 Oct 2003 20:29:34 -0000
*************** static void remove_dead_phis (basic_bloc
*** 95,101 ****
/* vector indicating an SSA name has already been processed and marked
as necessary. */
! static bool *processed;
/* Is a tree necessary? */
--- 95,101 ----
/* vector indicating an SSA name has already been processed and marked
as necessary. */
! static sbitmap processed;
/* Is a tree necessary? */
*************** mark_necessary (tree def, tree stmt)
*** 126,134 ****
if (def)
{
ver = SSA_NAME_VERSION (def);
! if (processed[ver])
return;
! processed[ver] = true;
if (!stmt)
stmt = SSA_NAME_DEF_STMT (def);
}
--- 126,134 ----
if (def)
{
ver = SSA_NAME_VERSION (def);
! if (TEST_BIT (processed, ver))
return;
! SET_BIT (processed, ver);
if (!stmt)
stmt = SSA_NAME_DEF_STMT (def);
}
*************** tree_ssa_dce (tree fndecl, enum tree_dum
*** 524,531 ****
VARRAY_TREE_INIT (worklist, 64, "work list");
! processed = (bool *)xmalloc (sizeof (bool) * next_ssa_version);
! memset (processed, 0, sizeof (bool) * next_ssa_version);
/* Initialize dump_file for debugging dumps. */
dump_file = dump_begin (phase, &dump_flags);
--- 524,531 ----
VARRAY_TREE_INIT (worklist, 64, "work list");
! processed = sbitmap_alloc (next_ssa_version + 1);
! sbitmap_zero (processed);
/* Initialize dump_file for debugging dumps. */
dump_file = dump_begin (phase, &dump_flags);
*************** tree_ssa_dce (tree fndecl, enum tree_dum
*** 540,546 ****
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "\nEliminating unnecessary instructions:\n");
! free (processed);
remove_dead_stmts ();
cleanup_tree_cfg ();
--- 540,546 ----
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "\nEliminating unnecessary instructions:\n");
! sbitmap_free (processed);
remove_dead_stmts ();
cleanup_tree_cfg ();