This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Remove all ggc'd bitmaps from PRE (Was Re: Memory overhead of tree-SSA optimization passes)


> > For PRE we consume most of memory in bitmaps, I am just testing patch
> > obstackeizing them that should actually help here reducing GGC garbage
> > to 40MB but still I don't follow why we need such an extreme amount of
> > bitmaps.
> 
> Here's a patch that removes all ggc'd bitmaps from PRE.
> 
> It's bootstrapping now (on a day old tree).
> If all goes well, i'll rebootstrap and testwhen the tree isn't broken,
> add a changelog, and commit it.
> 
> However, in any case, it should be usable for your measurement purposes.
> 
Actually I am using the attached patch.  It reduces the memory footprint
by 10% as one would expect that is good by itself I think.  I am waiting
for numbers form automated tester but unless bootstrap unbreaks we won't
get them before monday as I am just about leave for one day.

Is your patch actually able to re-use the bitmaps during the PRE
process?  If not, I think obstack are actually better here than xmalloc
based approach simply because the xmalloced bitmaps gets moved into free
pool where they will stay unused as no one else apparently needs that
many of them (but I plan to actually add some statistics too), while
obstack memory just gets used for other purposes cheaply.

But this all needs to wait for day after tomorrow...

Honza

Index: tree-ssa-pre.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-pre.c,v
retrieving revision 2.30
diff -c -3 -p -r2.30 tree-ssa-pre.c
*** tree-ssa-pre.c	20 Aug 2004 16:48:00 -0000	2.30
--- tree-ssa-pre.c	4 Sep 2004 13:13:54 -0000
*************** static alloc_pool value_set_node_pool;
*** 306,311 ****
--- 306,312 ----
  static alloc_pool binary_node_pool;
  static alloc_pool unary_node_pool;
  static alloc_pool reference_node_pool;
+ static struct obstack grand_bitmap_obstack;
  
  /* Set of blocks with statements that have had its EH information
     cleaned up.  */
*************** value_insert_into_set_bitmap (value_set_
*** 468,474 ****
  
    if (set->values == NULL)
      {
!       set->values = BITMAP_GGC_ALLOC ();
        bitmap_clear (set->values);
      }
  
--- 469,475 ----
  
    if (set->values == NULL)
      {
!       set->values = BITMAP_OBSTACK_ALLOC (&grand_bitmap_obstack);
        bitmap_clear (set->values);
      }
  
*************** static bitmap_set_t 
*** 482,489 ****
  bitmap_set_new (void)
  {
    bitmap_set_t ret = pool_alloc (bitmap_set_pool);
!   ret->expressions = BITMAP_GGC_ALLOC ();
!   ret->values = BITMAP_GGC_ALLOC ();
    bitmap_clear (ret->expressions);
    bitmap_clear (ret->values);
    return ret;
--- 483,490 ----
  bitmap_set_new (void)
  {
    bitmap_set_t ret = pool_alloc (bitmap_set_pool);
!   ret->expressions = BITMAP_OBSTACK_ALLOC (&grand_bitmap_obstack);
!   ret->values = BITMAP_OBSTACK_ALLOC (&grand_bitmap_obstack);
    bitmap_clear (ret->expressions);
    bitmap_clear (ret->values);
    return ret;
*************** init_pre (void)
*** 1944,1949 ****
--- 1945,1951 ----
    FOR_ALL_BB (bb)
      bb->aux = xcalloc (1, sizeof (struct bb_value_sets));
  
+   obstack_init (&grand_bitmap_obstack);
    phi_translate_table = htab_create (511, expr_pred_trans_hash,
  				     expr_pred_trans_eq, free);
    value_set_pool = create_alloc_pool ("Value sets",
*************** fini_pre (void)
*** 1980,1985 ****
--- 1982,1988 ----
  {
    basic_block bb;
  
+   obstack_free (&grand_bitmap_obstack, NULL);
    free_alloc_pool (value_set_pool);
    free_alloc_pool (bitmap_set_pool);
    free_alloc_pool (value_set_node_pool);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]