diff mbox

make tree-ssa-pre.c use alloc_aux_for_blocks

Message ID 20100810144039.GQ4130@codesourcery.com
State New
Headers show

Commit Message

Nathan Froyd Aug. 10, 2010, 2:40 p.m. UTC
As $SUBJECT suggests.  This change reduces overhead very slightly (no
need to have malloc header information on each aux info) and might even
speed things up very slightly by freeing memory faster and reusing
memory from the aux obstack.

Tested on x86_64-unknown-linux-gnu.  OK to commit?

-Nathan

	* tree-ssa-prec. (init_pre): Call alloc_aux_for_blocks.
	(fini_pre): Call free_aux_for_blocks.  Delete unused bb variable.

Comments

Richard Biener Aug. 10, 2010, 2:45 p.m. UTC | #1
On Tue, Aug 10, 2010 at 4:40 PM, Nathan Froyd <froydnj@codesourcery.com> wrote:
> As $SUBJECT suggests.  This change reduces overhead very slightly (no
> need to have malloc header information on each aux info) and might even
> speed things up very slightly by freeing memory faster and reusing
> memory from the aux obstack.
>
> Tested on x86_64-unknown-linux-gnu.  OK to commit?

Ok.

Thanks,
Richard.

> -Nathan
>
>        * tree-ssa-prec. (init_pre): Call alloc_aux_for_blocks.
>        (fini_pre): Call free_aux_for_blocks.  Delete unused bb variable.
>
> diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
> index 8293e97..88ebcf6 100644
> --- a/gcc/tree-ssa-pre.c
> +++ b/gcc/tree-ssa-pre.c
> @@ -4740,8 +4740,7 @@ init_pre (bool do_fre)
>   postorder = XNEWVEC (int, n_basic_blocks - NUM_FIXED_BLOCKS);
>   my_rev_post_order_compute (postorder, false);
>
> -  FOR_ALL_BB (bb)
> -    bb->aux = XCNEWVEC (struct bb_bitmap_sets, 1);
> +  alloc_aux_for_blocks (sizeof (struct bb_bitmap_sets));
>
>   calculate_dominance_info (CDI_POST_DOMINATORS);
>   calculate_dominance_info (CDI_DOMINATORS);
> @@ -4773,8 +4772,6 @@ init_pre (bool do_fre)
>  static void
>  fini_pre (bool do_fre)
>  {
> -  basic_block bb;
> -
>   free (postorder);
>   VEC_free (bitmap_set_t, heap, value_expressions);
>   BITMAP_FREE (inserted_exprs);
> @@ -4786,11 +4783,7 @@ fini_pre (bool do_fre)
>   htab_delete (expression_to_id);
>   VEC_free (unsigned, heap, name_to_id);
>
> -  FOR_ALL_BB (bb)
> -    {
> -      free (bb->aux);
> -      bb->aux = NULL;
> -    }
> +  free_aux_for_blocks ();
>
>   free_dominance_info (CDI_POST_DOMINATORS);
>
>
diff mbox

Patch

diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 8293e97..88ebcf6 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -4740,8 +4740,7 @@  init_pre (bool do_fre)
   postorder = XNEWVEC (int, n_basic_blocks - NUM_FIXED_BLOCKS);
   my_rev_post_order_compute (postorder, false);
 
-  FOR_ALL_BB (bb)
-    bb->aux = XCNEWVEC (struct bb_bitmap_sets, 1);
+  alloc_aux_for_blocks (sizeof (struct bb_bitmap_sets));
 
   calculate_dominance_info (CDI_POST_DOMINATORS);
   calculate_dominance_info (CDI_DOMINATORS);
@@ -4773,8 +4772,6 @@  init_pre (bool do_fre)
 static void
 fini_pre (bool do_fre)
 {
-  basic_block bb;
-
   free (postorder);
   VEC_free (bitmap_set_t, heap, value_expressions);
   BITMAP_FREE (inserted_exprs);
@@ -4786,11 +4783,7 @@  fini_pre (bool do_fre)
   htab_delete (expression_to_id);
   VEC_free (unsigned, heap, name_to_id);
 
-  FOR_ALL_BB (bb)
-    {
-      free (bb->aux);
-      bb->aux = NULL;
-    }
+  free_aux_for_blocks ();
 
   free_dominance_info (CDI_POST_DOMINATORS);