diff mbox

Flatten block_info arrays

Message ID 20100611154520.GI18540@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka June 11, 2010, 3:45 p.m. UTC
Hi,
this patch flattens the block_info array in df.  It is done by adding
block_info_elt_size field into df_problem structure.  I however have problem
that we no longer can test if block is already initialized.  I ended up using
bitmap->obstack test that is rather ugly but we don't have space for flag in
the array.

I am somewhat confused by the allocation.  It seems that now it would be best
to trash the bitmaps and initialize them every time problem is recomputed - this
will lead to better locality and initialization is now matter of setting the
bitmap pointer and does not involve other allocations.

I am however unsure how the lifetimes of local/global data are and what happens
with partial dataflow build.

The patch bootstrap/regtests x86_64, but I would be very happy if we found
nicer alternative to that obstack tests.

Honza

	* df-core.c (df_clear_bb_info): New function.
	(df_set_blocks): bb_info is always allocated.
	(df_get_bb_info): Use block_info_elt_size.
	(df_set_bb_info): Likewise.
	(df_compact_blocks): Update for new block_info.
	* df-problems.c (df_grow_bb_info): Likewise.
	(df_rd_set_bb_info): Remove.
	(df_rd_free_bb_info): Do not free block pool.
	(df_rd_alloc): Do not create pool, use check for
	obstack presence instead of NULL pointer for new blocks.
	(df_rd_free): DO not free alloc pool; clear block_info.
	(problem_RD): Add size of block info structure.
	(df_lr_set_bb_info): Remove.
	(df_lr_free_bb_info): Do not free block pool.
	(df_lr_alloc): Do not create pool, use check for
	obstack presence instead of NULL pointer for new blocks.
	(df_lr_free): DO not free alloc pool; clear block_info.
	(problem_LR): Add size of block info structure.
	(df_live_set_bb_info): Remove.
	(df_live_free_bb_info): Do not free block pool.
	(df_live_alloc): Do not create pool, use check for
	obstack presence instead of NULL pointer for new blocks.
	(df_live_free): DO not free alloc pool; clear block_info.
	(problem_LIVE): Add size of block info structure.
	(problem_CHAIN): Add size of block info structure.
	(df_byte_lr_set_bb_info): Remove.
	(df_byte_lr_free_bb_info): Do not free block pool.
	(df_byte_lr_alloc): Do not create pool, use check for
	obstack presence instead of NULL pointer for new blocks.
	(df_byte_lr_free): DO not free alloc pool; clear block_info.
	(problem_BYTE_LR): Add size of block info structure.
	(problem_NOTE): Add size of block info structure.
	(df_byte_MD_set_bb_info): Remove.
	(df_byte_MD_free_bb_info): Do not free block pool.
	(df_byte_MD_alloc): Do not create pool, use check for
	obstack presence instead of NULL pointer for new blocks.
	(df_byte_MD_free): DO not free alloc pool; clear block_info.
	(problem_BD): Add size of block info structure.
	* df-scan.c (df_scan_free_internal): Free block pool.
	(df_scan_set_bb_info): Remove.
	(df_scan_free_bb_info): Check for artificial_defs instead
	of bb_info being non-NULL.
	(df_scan_alloc): DO not create df_scan_block pool.
	(problem_SCAN): Set size of block info.
	(df_bb_refs_record): Do not allocate bb_info.
	* df.h (df_problem): Add block_info_elt_size.
	(struct dataflow): Change block_info to void *.
	(df_scan_get_bb_info, df_rd_get_bb_info, df_lr_get_bb_info,
	df_md_get_bb_info, df_live_get_bb_info, df_byte_lr_get_bb_info): Return
	in-line structures.

Comments

Paolo Bonzini June 11, 2010, 4:01 p.m. UTC | #1
On 06/11/2010 05:45 PM, Jan Hubicka wrote:
> +	  int size = last_basic_block * dflow->problem->block_info_elt_size;
> +	  problem_temps = XNEWVAR (void *, size);

Not a void* anymore.

Also, since you're doing it please move df_grow_bb_info to df-core.c

> +      /* When bitmaps are already initialized, just clear them.  */
> +      if (bb_info->kill.obstack)

This is fine by me.

Paolo
diff mbox

Patch

Index: df-core.c
===================================================================
--- df-core.c	(revision 160615)
+++ df-core.c	(working copy)
@@ -399,6 +399,7 @@  are write-only operations.
 
 static void *df_get_bb_info (struct dataflow *, unsigned int);
 static void df_set_bb_info (struct dataflow *, unsigned int, void *);
+static void df_clear_bb_info (struct dataflow *, unsigned int);
 #ifdef DF_DEBUG_CFG
 static void df_set_clean_cfg (void);
 #endif
@@ -523,11 +524,8 @@  df_set_blocks (bitmap blocks)
 		      if (bb)
 			{
 			  void *bb_info = df_get_bb_info (dflow, bb_index);
-			  if (bb_info)
-			    {
-			      dflow->problem->free_bb_fun (bb, bb_info);
-			      df_set_bb_info (dflow, bb_index, NULL);
-			    }
+			  dflow->problem->free_bb_fun (bb, bb_info);
+			  df_clear_bb_info (dflow, bb_index);
 			}
 		    }
 		}
@@ -1294,7 +1292,8 @@  df_get_bb_info (struct dataflow *dflow,
     return NULL;
   if (index >= dflow->block_info_size)
     return NULL;
-  return (struct df_scan_bb_info *) dflow->block_info[index];
+  return (void *)((char *)dflow->block_info
+		  + index * dflow->problem->block_info_elt_size);
 }
 
 
@@ -1305,7 +1304,22 @@  df_set_bb_info (struct dataflow *dflow,
 		void *bb_info)
 {
   gcc_assert (dflow->block_info);
-  dflow->block_info[index] = bb_info;
+  memcpy ((char *)dflow->block_info
+	  + index * dflow->problem->block_info_elt_size,
+	  bb_info, dflow->problem->block_info_elt_size);
+}
+
+
+/* Clear basic block info.  */
+
+static void
+df_clear_bb_info (struct dataflow *dflow, unsigned int index)
+{
+  gcc_assert (dflow->block_info);
+  gcc_assert (dflow->block_info_size > index);
+  memset ((char *)dflow->block_info
+	  + index * dflow->problem->block_info_elt_size,
+	  0, dflow->problem->block_info_elt_size);
 }
 
 
@@ -1400,10 +1414,8 @@  df_compact_blocks (void)
 {
   int i, p;
   basic_block bb;
-  void **problem_temps;
-  int size = last_basic_block * sizeof (void *);
+  void *problem_temps;
   bitmap_head tmp;
-  problem_temps = XNEWVAR (void *, size);
 
   bitmap_initialize (&tmp, &df_bitmap_obstack);
   for (p = 0; p < df->num_problems_defined; p++)
@@ -1433,6 +1445,8 @@  df_compact_blocks (void)
       /* Now shuffle the block info for the problem.  */
       if (dflow->problem->free_bb_fun)
 	{
+	  int size = last_basic_block * dflow->problem->block_info_elt_size;
+	  problem_temps = XNEWVAR (void *, size);
 	  df_grow_bb_info (dflow);
 	  memcpy (problem_temps, dflow->block_info, size);
 
@@ -1442,22 +1456,15 @@  df_compact_blocks (void)
 	  i = NUM_FIXED_BLOCKS;
 	  FOR_EACH_BB (bb)
 	    {
-	      df_set_bb_info (dflow, i, problem_temps[bb->index]);
-	      problem_temps[bb->index] = NULL;
+	      df_set_bb_info (dflow, i,
+			      (char *)problem_temps
+			      + bb->index * dflow->problem->block_info_elt_size);
 	      i++;
 	    }
-	  memset (dflow->block_info + i, 0,
-		  (last_basic_block - i) *sizeof (void *));
-
-	  /* Free any block infos that were not copied (and NULLed).
-	     These are from orphaned blocks.  */
-	  for (i = NUM_FIXED_BLOCKS; i < last_basic_block; i++)
-	    {
-	      basic_block bb = BASIC_BLOCK (i);
-	      if (problem_temps[i] && bb)
-		dflow->problem->free_bb_fun
-		  (bb, problem_temps[i]);
-	    }
+	  memset ((char *)dflow->block_info
+		  + i * dflow->problem->block_info_elt_size, 0,
+		  (last_basic_block - i)
+		  * dflow->problem->block_info_elt_size);
 	}
     }
 
@@ -1482,8 +1489,6 @@  df_compact_blocks (void)
 
   bitmap_clear (&tmp);
 
-  free (problem_temps);
-
   i = NUM_FIXED_BLOCKS;
   FOR_EACH_BB (bb)
     {
@@ -1525,7 +1530,6 @@  df_bb_replace (int old_index, basic_bloc
       if (dflow->block_info)
 	{
 	  df_grow_bb_info (dflow);
-	  gcc_assert (df_get_bb_info (dflow, old_index) == NULL);
 	  df_set_bb_info (dflow, old_index,
 			  df_get_bb_info (dflow, new_block_index));
 	}
@@ -1561,7 +1565,7 @@  df_bb_delete (int bb_index)
 	  if (bb_info)
 	    {
 	      dflow->problem->free_bb_fun (bb, bb_info);
-	      df_set_bb_info (dflow, bb_index, NULL);
+	      df_clear_bb_info (dflow, bb_index);
 	    }
 	}
     }
Index: df-problems.c
===================================================================
--- df-problems.c	(revision 160615)
+++ df-problems.c	(working copy)
@@ -109,9 +110,15 @@  df_grow_bb_info (struct dataflow *dflow)
   if (dflow->block_info_size < new_size)
     {
       new_size += new_size / 4;
-      dflow->block_info = XRESIZEVEC (void *, dflow->block_info, new_size);
-      memset (dflow->block_info + dflow->block_info_size, 0,
-	      (new_size - dflow->block_info_size) *sizeof (void *));
+      dflow->block_info = XRESIZEVEC (char *, dflow->block_info,
+				      new_size
+				      * dflow->problem->block_info_elt_size);
+      memset ((char *)dflow->block_info
+	      + dflow->block_info_size
+	      * dflow->problem->block_info_elt_size,
+	      0,
+	      (new_size - dflow->block_info_size)
+	      * dflow->problem->block_info_elt_size);
       dflow->block_info_size = new_size;
     }
 }
@@ -202,17 +209,6 @@  struct df_rd_problem_data
   bitmap_obstack rd_bitmaps;
 };
 
-/* Set basic block info.  */
-
-static void
-df_rd_set_bb_info (unsigned int index,
-		   struct df_rd_bb_info *bb_info)
-{
-  gcc_assert (df_rd);
-  gcc_assert (index < df_rd->block_info_size);
-  df_rd->block_info[index] = bb_info;
-}
-
 
 /* Free basic block info.  */
 
@@ -228,7 +224,6 @@  df_rd_free_bb_info (basic_block bb ATTRI
       bitmap_clear (&bb_info->gen);
       bitmap_clear (&bb_info->in);
       bitmap_clear (&bb_info->out);
-      pool_free (df_rd->block_pool, bb_info);
     }
 }
 
@@ -243,10 +238,6 @@  df_rd_alloc (bitmap all_blocks)
   bitmap_iterator bi;
   struct df_rd_problem_data *problem_data;
 
-  if (!df_rd->block_pool)
-    df_rd->block_pool = create_alloc_pool ("df_rd_block pool",
-					   sizeof (struct df_rd_bb_info), 50);
-
   if (df_rd->problem_data)
     {
       problem_data = (struct df_rd_problem_data *) df_rd->problem_data;
@@ -274,7 +265,9 @@  df_rd_alloc (bitmap all_blocks)
   EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi)
     {
       struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index);
-      if (bb_info)
+      
+      /* When bitmaps are already initialized, just clear them.  */
+      if (bb_info->kill.obstack)
 	{
 	  bitmap_clear (&bb_info->kill);
 	  bitmap_clear (&bb_info->sparse_kill);
@@ -282,8 +275,6 @@  df_rd_alloc (bitmap all_blocks)
 	}
       else
 	{
-	  bb_info = (struct df_rd_bb_info *) pool_alloc (df_rd->block_pool);
-	  df_rd_set_bb_info (bb_index, bb_info);
 	  bitmap_initialize (&bb_info->kill, &problem_data->rd_bitmaps);
 	  bitmap_initialize (&bb_info->sparse_kill, &problem_data->rd_bitmaps);
 	  bitmap_initialize (&bb_info->gen, &problem_data->rd_bitmaps);
@@ -607,11 +598,11 @@  df_rd_free (void)
 
   if (problem_data)
     {
-      free_alloc_pool (df_rd->block_pool);
       bitmap_obstack_release (&problem_data->rd_bitmaps);
 
       df_rd->block_info_size = 0;
       free (df_rd->block_info);
+      df_rd->block_info = NULL;
       free (df_rd->problem_data);
     }
   free (df_rd);
@@ -703,6 +694,7 @@  static struct df_problem problem_RD =
   NULL,                       /* Incremental solution verify start.  */
   NULL,                       /* Incremental solution verify end.  */
   NULL,                       /* Dependent problem.  */
+  sizeof (struct df_rd_bb_info),/* Size of entry of block_info array.  */
   TV_DF_RD,                   /* Timing variable.  */
   true                        /* Reset blocks on dropping out of blocks_to_analyze.  */
 };
@@ -738,19 +730,6 @@  struct df_lr_problem_data
   bitmap_obstack lr_bitmaps;
 };
 
-
-/* Set basic block info.  */
-
-static void
-df_lr_set_bb_info (unsigned int index,
-		   struct df_lr_bb_info *bb_info)
-{
-  gcc_assert (df_lr);
-  gcc_assert (index < df_lr->block_info_size);
-  df_lr->block_info[index] = bb_info;
-}
-
-
 /* Free basic block info.  */
 
 static void
@@ -764,7 +743,6 @@  df_lr_free_bb_info (basic_block bb ATTRI
       bitmap_clear (&bb_info->def);
       bitmap_clear (&bb_info->in);
       bitmap_clear (&bb_info->out);
-      pool_free (df_lr->block_pool, bb_info);
     }
 }
 
@@ -779,10 +757,6 @@  df_lr_alloc (bitmap all_blocks ATTRIBUTE
   bitmap_iterator bi;
   struct df_lr_problem_data *problem_data;
 
-  if (!df_lr->block_pool)
-    df_lr->block_pool = create_alloc_pool ("df_lr_block pool",
-					   sizeof (struct df_lr_bb_info), 50);
-
   df_grow_bb_info (df_lr);
   if (df_lr->problem_data)
     problem_data = (struct df_lr_problem_data *) df_lr->problem_data;
@@ -799,15 +773,15 @@  df_lr_alloc (bitmap all_blocks ATTRIBUTE
   EXECUTE_IF_SET_IN_BITMAP (df_lr->out_of_date_transfer_functions, 0, bb_index, bi)
     {
       struct df_lr_bb_info *bb_info = df_lr_get_bb_info (bb_index);
-      if (bb_info)
+      
+      /* When bitmaps are already initialized, just clear them.  */
+      if (bb_info->use.obstack)
 	{
 	  bitmap_clear (&bb_info->def);
 	  bitmap_clear (&bb_info->use);
 	}
       else
 	{
-	  bb_info = (struct df_lr_bb_info *) pool_alloc (df_lr->block_pool);
-	  df_lr_set_bb_info (bb_index, bb_info);
 	  bitmap_initialize (&bb_info->use, &problem_data->lr_bitmaps);
 	  bitmap_initialize (&bb_info->def, &problem_data->lr_bitmaps);
 	  bitmap_initialize (&bb_info->in, &problem_data->lr_bitmaps);
@@ -1091,10 +1065,10 @@  df_lr_free (void)
     = (struct df_lr_problem_data *) df_lr->problem_data;
   if (df_lr->block_info)
     {
-      free_alloc_pool (df_lr->block_pool);
 
       df_lr->block_info_size = 0;
       free (df_lr->block_info);
+      df_lr->block_info = NULL;
       bitmap_obstack_release (&problem_data->lr_bitmaps);
       free (df_lr->problem_data);
       df_lr->problem_data = NULL;
@@ -1253,6 +1227,7 @@  static struct df_problem problem_LR =
   df_lr_verify_solution_start,/* Incremental solution verify start.  */
   df_lr_verify_solution_end,  /* Incremental solution verify end.  */
   NULL,                       /* Dependent problem.  */
+  sizeof (struct df_lr_bb_info),/* Size of entry of block_info array.  */
   TV_DF_LR,                   /* Timing variable.  */
   false                       /* Reset blocks on dropping out of blocks_to_analyze.  */
 };
@@ -1370,17 +1345,6 @@  struct df_live_problem_data
    combined lr and live analysis.  */
 static bitmap_head df_live_scratch;
 
-/* Set basic block info.  */
-
-static void
-df_live_set_bb_info (unsigned int index,
-		   struct df_live_bb_info *bb_info)
-{
-  gcc_assert (df_live);
-  gcc_assert (index < df_live->block_info_size);
-  df_live->block_info[index] = bb_info;
-}
-
 
 /* Free basic block info.  */
 
@@ -1395,7 +1359,6 @@  df_live_free_bb_info (basic_block bb ATT
       bitmap_clear (&bb_info->kill);
       bitmap_clear (&bb_info->in);
       bitmap_clear (&bb_info->out);
-      pool_free (df_live->block_pool, bb_info);
     }
 }
 
@@ -1410,9 +1373,6 @@  df_live_alloc (bitmap all_blocks ATTRIBU
   bitmap_iterator bi;
   struct df_live_problem_data *problem_data;
 
-  if (!df_live->block_pool)
-    df_live->block_pool = create_alloc_pool ("df_live_block pool",
-					   sizeof (struct df_live_bb_info), 100);
   if (df_live->problem_data)
     problem_data = (struct df_live_problem_data *) df_live->problem_data;
   else
@@ -1431,15 +1391,15 @@  df_live_alloc (bitmap all_blocks ATTRIBU
   EXECUTE_IF_SET_IN_BITMAP (df_live->out_of_date_transfer_functions, 0, bb_index, bi)
     {
       struct df_live_bb_info *bb_info = df_live_get_bb_info (bb_index);
-      if (bb_info)
+      
+      /* When bitmaps are already initialized, just clear them.  */
+      if (bb_info->kill.obstack)
 	{
 	  bitmap_clear (&bb_info->kill);
 	  bitmap_clear (&bb_info->gen);
 	}
       else
 	{
-	  bb_info = (struct df_live_bb_info *) pool_alloc (df_live->block_pool);
-	  df_live_set_bb_info (bb_index, bb_info);
 	  bitmap_initialize (&bb_info->kill, &problem_data->live_bitmaps);
 	  bitmap_initialize (&bb_info->gen, &problem_data->live_bitmaps);
 	  bitmap_initialize (&bb_info->in, &problem_data->live_bitmaps);
@@ -1639,9 +1599,9 @@  df_live_free (void)
     = (struct df_live_problem_data *) df_live->problem_data;
   if (df_live->block_info)
     {
-      free_alloc_pool (df_live->block_pool);
       df_live->block_info_size = 0;
       free (df_live->block_info);
+      df_live->block_info = NULL;
       bitmap_clear (&df_live_scratch);
       bitmap_obstack_release (&problem_data->live_bitmaps);
       free (problem_data);
@@ -1796,6 +1756,7 @@  static struct df_problem problem_LIVE =
   df_live_verify_solution_start,/* Incremental solution verify start.  */
   df_live_verify_solution_end,  /* Incremental solution verify end.  */
   &problem_LR,                  /* Dependent problem.  */
+  sizeof (struct df_live_bb_info),/* Size of entry of block_info array.  */
   TV_DF_LIVE,                   /* Timing variable.  */
   false                         /* Reset blocks on dropping out of blocks_to_analyze.  */
 };
@@ -2322,6 +2283,7 @@  static struct df_problem problem_CHAIN =
   NULL,                       /* Incremental solution verify start.  */
   NULL,                       /* Incremental solution verify end.  */
   &problem_RD,                /* Dependent problem.  */
+  sizeof (struct df_scan_bb_info),/* Size of entry of block_info array.  */
   TV_DF_CHAIN,                /* Timing variable.  */
   false                       /* Reset blocks on dropping out of blocks_to_analyze.  */
 };
@@ -2414,18 +2376,6 @@  df_byte_lr_get_regno_len (unsigned int r
 }
 
 
-/* Set basic block info.  */
-
-static void
-df_byte_lr_set_bb_info (unsigned int index,
-			struct df_byte_lr_bb_info *bb_info)
-{
-  gcc_assert (df_byte_lr);
-  gcc_assert (index < df_byte_lr->block_info_size);
-  df_byte_lr->block_info[index] = bb_info;
-}
-
-
 /* Free basic block info.  */
 
 static void
@@ -2439,7 +2389,6 @@  df_byte_lr_free_bb_info (basic_block bb
       bitmap_clear (&bb_info->def);
       bitmap_clear (&bb_info->in);
       bitmap_clear (&bb_info->out);
-      pool_free (df_byte_lr->block_pool, bb_info);
     }
 }
 
@@ -2502,10 +2451,6 @@  df_byte_lr_alloc (bitmap all_blocks ATTR
 
   df_byte_lr->problem_data = problem_data;
 
-  if (!df_byte_lr->block_pool)
-    df_byte_lr->block_pool = create_alloc_pool ("df_byte_lr_block pool",
-					   sizeof (struct df_byte_lr_bb_info), 50);
-
   df_grow_bb_info (df_byte_lr);
 
   /* Create the mapping from regnos to slots. This does not change
@@ -2566,15 +2511,15 @@  df_byte_lr_alloc (bitmap all_blocks ATTR
   EXECUTE_IF_SET_IN_BITMAP (df_byte_lr->out_of_date_transfer_functions, 0, bb_index, bi)
     {
       struct df_byte_lr_bb_info *bb_info = df_byte_lr_get_bb_info (bb_index);
-      if (bb_info)
+      
+      /* When bitmaps are already initialized, just clear them.  */
+      if (bb_info->use.obstack)
 	{
 	  bitmap_clear (&bb_info->def);
 	  bitmap_clear (&bb_info->use);
 	}
       else
 	{
-	  bb_info = (struct df_byte_lr_bb_info *) pool_alloc (df_byte_lr->block_pool);
-	  df_byte_lr_set_bb_info (bb_index, bb_info);
 	  bitmap_initialize (&bb_info->use, &problem_data->byte_lr_bitmaps);
 	  bitmap_initialize (&bb_info->def, &problem_data->byte_lr_bitmaps);
 	  bitmap_initialize (&bb_info->in, &problem_data->byte_lr_bitmaps);
@@ -2834,9 +2779,9 @@  df_byte_lr_free (void)
 
   if (df_byte_lr->block_info)
     {
-      free_alloc_pool (df_byte_lr->block_pool);
       df_byte_lr->block_info_size = 0;
       free (df_byte_lr->block_info);
+      df_byte_lr->block_info = NULL;
     }
 
   BITMAP_FREE (df_byte_lr->out_of_date_transfer_functions);
@@ -2903,7 +2848,8 @@  static struct df_problem problem_BYTE_LR
   df_byte_lr_bottom_dump,          /* Debugging end block.  */
   NULL,                            /* Incremental solution verify start.  */
   NULL,                            /* Incremental solution verify end.  */
-  NULL,                            /* Dependent problem.  */
+  NULL,                       /* Dependent problem.  */
+  sizeof (struct df_byte_lr_bb_info),/* Size of entry of block_info array.  */
   TV_DF_BYTE_LR,                   /* Timing variable.  */
   false                            /* Reset blocks on dropping out of blocks_to_analyze.  */
 };
@@ -3874,6 +3768,7 @@  static struct df_problem problem_NOTE =
   NULL,                       /* Incremental solution verify start.  */
   NULL,                       /* Incremental solution verify end.  */
   &problem_LR,                /* Dependent problem.  */
+  sizeof (struct df_scan_bb_info),/* Size of entry of block_info array.  */
   TV_DF_NOTE,                 /* Timing variable.  */
   false                       /* Reset blocks on dropping out of blocks_to_analyze.  */
 };
@@ -4213,17 +4108,6 @@  struct df_md_problem_data
    only for live registers.  */
 static bitmap_head df_md_scratch;
 
-/* Set basic block info.  */
-
-static void
-df_md_set_bb_info (unsigned int index,
-                   struct df_md_bb_info *bb_info)
-{
-  gcc_assert (df_md);
-  gcc_assert (index < df_md->block_info_size);
-  df_md->block_info[index] = bb_info;
-}
-
 
 static void
 df_md_free_bb_info (basic_block bb ATTRIBUTE_UNUSED,
@@ -4237,7 +4121,6 @@  df_md_free_bb_info (basic_block bb ATTRI
       bitmap_clear (&bb_info->init);
       bitmap_clear (&bb_info->in);
       bitmap_clear (&bb_info->out);
-      pool_free (df_md->block_pool, bb_info);
     }
 }
 
@@ -4252,10 +4135,6 @@  df_md_alloc (bitmap all_blocks)
   bitmap_iterator bi;
   struct df_md_problem_data *problem_data;
 
-  if (!df_md->block_pool)
-    df_md->block_pool = create_alloc_pool ("df_md_block pool",
-                                           sizeof (struct df_md_bb_info), 50);
-
   df_grow_bb_info (df_md);
   if (df_md->problem_data)
     problem_data = (struct df_md_problem_data *) df_md->problem_data;
@@ -4270,7 +4149,8 @@  df_md_alloc (bitmap all_blocks)
   EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi)
     {
       struct df_md_bb_info *bb_info = df_md_get_bb_info (bb_index);
-      if (bb_info)
+      /* When bitmaps are already initialized, just clear them.  */
+      if (bb_info->init.obstack)
         {
           bitmap_clear (&bb_info->init);
           bitmap_clear (&bb_info->gen);
@@ -4280,8 +4160,6 @@  df_md_alloc (bitmap all_blocks)
         }
       else
         {
-          bb_info = (struct df_md_bb_info *) pool_alloc (df_md->block_pool);
-          df_md_set_bb_info (bb_index, bb_info);
 	  bitmap_initialize (&bb_info->init, &problem_data->md_bitmaps);
 	  bitmap_initialize (&bb_info->gen, &problem_data->md_bitmaps);
 	  bitmap_initialize (&bb_info->kill, &problem_data->md_bitmaps);
@@ -4543,12 +4421,12 @@  df_md_free (void)
     = (struct df_md_problem_data *) df_md->problem_data;
 
   bitmap_obstack_release (&problem_data->md_bitmaps);
-  free_alloc_pool (df_md->block_pool);
   free (problem_data);
   df_md->problem_data = NULL;
 
   df_md->block_info_size = 0;
   free (df_md->block_info);
+  df_md->block_info = NULL;
   free (df_md);
 }
 
@@ -4607,6 +4485,7 @@  static struct df_problem problem_MD =
   NULL,			      /* Incremental solution verify start.  */
   NULL,			      /* Incremental solution verify end.  */
   NULL,                       /* Dependent problem.  */
+  sizeof (struct df_md_bb_info),/* Size of entry of block_info array.  */
   TV_DF_MD,                   /* Timing variable.  */
   false                       /* Reset blocks on dropping out of blocks_to_analyze.  */
 };
Index: df-scan.c
===================================================================
--- df-scan.c	(revision 160615)
+++ df-scan.c	(working copy)
@@ -266,7 +266,6 @@  df_scan_free_internal (void)
   bitmap_clear (&df->insns_to_rescan);
   bitmap_clear (&df->insns_to_notes_rescan);
 
-  free_alloc_pool (df_scan->block_pool);
   free_alloc_pool (problem_data->ref_base_pool);
   free_alloc_pool (problem_data->ref_artificial_pool);
   free_alloc_pool (problem_data->ref_regular_pool);
@@ -280,17 +279,6 @@  df_scan_free_internal (void)
 }
 
 
-/* Set basic block info.  */
-
-static void
-df_scan_set_bb_info (unsigned int index,
-		     struct df_scan_bb_info *bb_info)
-{
-  df_grow_bb_info (df_scan);
-  df_scan->block_info[index] = (void *) bb_info;
-}
-
-
 /* Free basic block info.  */
 
 static void
@@ -298,7 +286,9 @@  df_scan_free_bb_info (basic_block bb, vo
 {
   struct df_scan_bb_info *bb_info = (struct df_scan_bb_info *) vbb_info;
   unsigned int bb_index = bb->index;
-  if (bb_info)
+
+  /* See if bb_info is initialized.  */
+  if (bb_info->artificial_defs)
     {
       rtx insn;
       FOR_BB_INSNS (bb, insn)
@@ -312,13 +302,15 @@  df_scan_free_bb_info (basic_block bb, vo
 	bb_info = df_scan_get_bb_info (bb_index);
 
       /* Get rid of any artificial uses or defs.  */
-      df_ref_chain_delete_du_chain (bb_info->artificial_defs);
-      df_ref_chain_delete_du_chain (bb_info->artificial_uses);
-      df_ref_chain_delete (bb_info->artificial_defs);
-      df_ref_chain_delete (bb_info->artificial_uses);
-      bb_info->artificial_defs = NULL;
-      bb_info->artificial_uses = NULL;
-      pool_free (df_scan->block_pool, bb_info);
+      if (bb_info->artificial_defs)
+	{
+	  df_ref_chain_delete_du_chain (bb_info->artificial_defs);
+	  df_ref_chain_delete_du_chain (bb_info->artificial_uses);
+	  df_ref_chain_delete (bb_info->artificial_defs);
+	  df_ref_chain_delete (bb_info->artificial_uses);
+	  bb_info->artificial_defs = NULL;
+	  bb_info->artificial_uses = NULL;
+	}
     }
 }
 
@@ -339,11 +331,6 @@  df_scan_alloc (bitmap all_blocks ATTRIBU
   if (df_scan->problem_data)
     df_scan_free_internal ();
 
-  df_scan->block_pool
-    = create_alloc_pool ("df_scan_block pool",
-			 sizeof (struct df_scan_bb_info),
-			 block_size);
-
   problem_data = XNEW (struct df_scan_problem_data);
   df_scan->problem_data = problem_data;
   df_scan->computed = true;
@@ -383,11 +370,6 @@  df_scan_alloc (bitmap all_blocks ATTRIBU
     {
       unsigned int bb_index = bb->index;
       struct df_scan_bb_info *bb_info = df_scan_get_bb_info (bb_index);
-      if (!bb_info)
-	{
-	  bb_info = (struct df_scan_bb_info *) pool_alloc (df_scan->block_pool);
-	  df_scan_set_bb_info (bb_index, bb_info);
-	}
       bb_info->artificial_defs = NULL;
       bb_info->artificial_uses = NULL;
     }
@@ -539,6 +521,7 @@  static struct df_problem problem_SCAN =
   NULL,                       /* Incremental solution verify start.  */
   NULL,                       /* Incremental solution verify end.  */
   NULL,                       /* Dependent problem.  */
+  sizeof (struct df_scan_bb_info),/* Size of entry of block_info array.  */
   TV_DF_SCAN,                 /* Timing variable.  */
   false                       /* Reset blocks on dropping out of blocks_to_analyze.  */
 };
@@ -3698,23 +3681,12 @@  df_bb_refs_record (int bb_index, bool sc
   basic_block bb = BASIC_BLOCK (bb_index);
   rtx insn;
   int luid = 0;
-  struct df_scan_bb_info *bb_info;
   struct df_collection_rec collection_rec;
 
   if (!df)
     return;
 
-  bb_info = df_scan_get_bb_info (bb_index);
-
-  /* Need to make sure that there is a record in the basic block info. */
-  if (!bb_info)
-    {
-      bb_info = (struct df_scan_bb_info *) pool_alloc (df_scan->block_pool);
-      df_scan_set_bb_info (bb_index, bb_info);
-      bb_info->artificial_defs = NULL;
-      bb_info->artificial_uses = NULL;
-    }
-
+  df_grow_bb_info (df_scan);
   collection_rec.def_vec = VEC_alloc (df_ref, stack, 128);
   collection_rec.use_vec = VEC_alloc (df_ref, stack, 32);
   collection_rec.eq_use_vec = VEC_alloc (df_ref, stack, 32);