From f548ece7abc0a0c81dd049e9f8b480ff2c38e18b Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 14 Feb 2023 16:36:03 +0100 Subject: middle-end/108786 - add bitmap_clear_first_set_bit This adds bitmap_clear_first_set_bit and uses it where previously bitmap_clear_bit followed bitmap_first_set_bit. The advantage is speeding up the search and avoiding to clobber ->current. PR middle-end/108786 * bitmap.h (bitmap_clear_first_set_bit): New. * bitmap.cc (bitmap_first_set_bit_worker): Rename from bitmap_first_set_bit and add optional clearing of the bit. (bitmap_first_set_bit): Wrap bitmap_first_set_bit_worker. (bitmap_clear_first_set_bit): Likewise. * df-core.cc (df_worklist_dataflow_doublequeue): Use bitmap_clear_first_set_bit. * graphite-scop-detection.cc (scop_detection::merge_sese): Likewise. * sanopt.cc (sanitize_asan_mark_unpoison): Likewise. (sanitize_asan_mark_poison): Likewise. * tree-cfgcleanup.cc (cleanup_tree_cfg_noloop): Likewise. * tree-into-ssa.cc (rewrite_blocks): Likewise. * tree-ssa-dce.cc (simple_dce_from_worklist): Likewise. * tree-ssa-sccvn.cc (do_rpo_vn_1): Likewise. --- gcc/bitmap.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gcc/bitmap.h') diff --git a/gcc/bitmap.h b/gcc/bitmap.h index 43337d2..5432f38 100644 --- a/gcc/bitmap.h +++ b/gcc/bitmap.h @@ -110,6 +110,7 @@ along with GCC; see the file COPYING3. If not see * clear : bitmap_clear * smallest_member : bitmap_first_set_bit + * pop_smallest : bitmap_clear_first_set_bit * choose_one : (not implemented, but could be in constant time) @@ -133,6 +134,7 @@ along with GCC; see the file COPYING3. If not see amortized time with O(E) worst-case behavior. * smallest_member + * pop_smallest * largest_member * set_size * member_p @@ -501,6 +503,7 @@ extern void debug (const bitmap_head &ref); extern void debug (const bitmap_head *ptr); extern unsigned bitmap_first_set_bit (const_bitmap); +extern unsigned bitmap_clear_first_set_bit (bitmap); extern unsigned bitmap_last_set_bit (const_bitmap); /* Compute bitmap hash (for purposes of hashing etc.) */ -- cgit v1.1