[PATCH] Avoid two bitmap_copies in df

Richard Biener rguenther@suse.de
Tue Mar 18 12:35:00 GMT 2014


I found this patch in my local tree which avoids copying a bitmap
by doing

	bitmap_and_compl (&tmp, op2, dense_invalidated);

instead of

	bitmap_copy (&tmp, op2);
	bitmap_and_compl_into (&tmp, dense_invalidated);

which should besides speed also eventually reduce peak memory
usage.

Bootstrap and regtest running on x86_64-unknown-linux-gnu, ok for trunk?

Thanks,
Richard.

2014-03-18  Richard Biener  <rguenther@suse.de>

	* df-problems.c (df_rd_confluence_n): Avoid bitmap_copy
	by using bitmap_and_compl instead of bitmap_and_compl_into.
	(df_rd_transfer_function): Likewise.

Index: gcc/df-problems.c
===================================================================
--- gcc/df-problems.c	(revision 208642)
+++ gcc/df-problems.c	(working copy)
@@ -479,8 +479,7 @@ df_rd_confluence_n (edge e)
       bitmap_head tmp;
 
       bitmap_initialize (&tmp, &df_bitmap_obstack);
-      bitmap_copy (&tmp, op2);
-      bitmap_and_compl_into (&tmp, dense_invalidated);
+      bitmap_and_compl (&tmp, op2, dense_invalidated);
 
       EXECUTE_IF_SET_IN_BITMAP (sparse_invalidated, 0, regno, bi)
  	{
@@ -524,14 +523,13 @@ df_rd_transfer_function (int bb_index)
       problem_data = (struct df_rd_problem_data *) df_rd->problem_data;
       bitmap_initialize (&tmp, &problem_data->rd_bitmaps);
 
-      bitmap_copy (&tmp, in);
+      bitmap_and_compl (&tmp, in, kill);
       EXECUTE_IF_SET_IN_BITMAP (sparse_kill, 0, regno, bi)
 	{
 	  bitmap_clear_range (&tmp,
 			      DF_DEFS_BEGIN (regno),
 			      DF_DEFS_COUNT (regno));
 	}
-      bitmap_and_compl_into (&tmp, kill);
       bitmap_ior_into (&tmp, gen);
       changed = !bitmap_equal_p (&tmp, out);
       if (changed)



More information about the Gcc-patches mailing list