https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108786
Bug ID: 108786 Summary: bitmap_first_set_bit misses a bitmap_clear_first_bit Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: rguenth at gcc dot gnu.org Target Milestone: --- We have a repeated pattern for worklists doing unsigned idx = bitmap_first_set_bit (b); bitmap_clear_bit (b, idx); but bitmap_clear_bit is more expensive and in particular prone to clobber ->current which will pessimize other accesses to the same bitmap. bitmap_clear_first_bit would return the bit number cleared so it can be used to pop an item from a worklist efficiently. If the order doesn't matter a pick-one API also is missing which would be more efficient for the tree form.