diff mbox

Speedup bitmap_find_bit

Message ID alpine.LSU.2.11.1512041255020.4884@t29.fhfr.qr
State New
Headers show

Commit Message

Richard Biener Dec. 4, 2015, 11:57 a.m. UTC
This properly guards the bitmap_mem_desc.get_descriptor_for_instance
call with GATHER_STATISTICS - the hashmap is globally initialized
and thus a query isn't very well inline optimized even if the map
is empty.

Committed as obvious.

Richard.

2015-12-04  Richard Biener  <rguenther@suse.de>

	* bitmap.c (bitmap_find_bit): Guard the bitmap descriptor
	query with GATHER_STATISTICS.
diff mbox

Patch

Index: gcc/bitmap.c
===================================================================
--- gcc/bitmap.c	(revision 231256)
+++ gcc/bitmap.c	(working copy)
@@ -487,9 +487,11 @@  bitmap_find_bit (bitmap head, unsigned i
       && head->first->next == NULL)
     return NULL;
 
-   /* Usage can be NULL due to allocated bitmaps for which we do not
-      call initialize function.  */
-   bitmap_usage *usage = bitmap_mem_desc.get_descriptor_for_instance (head);
+  /* Usage can be NULL due to allocated bitmaps for which we do not
+     call initialize function.  */
+  bitmap_usage *usage = NULL;
+  if (GATHER_STATISTICS)
+    usage = bitmap_mem_desc.get_descriptor_for_instance (head);
 
   /* This bitmap has more than one element, and we're going to look
      through the elements list.  Count that as a search.  */