On 11/27/25 1:52 AM, Alexandre Oliva wrote:
On Nov 26, 2025, Vladimir Makarov <[email protected]> wrote:
I any case any saving is welcome. Taking also into account that the
iterator is simpler, I'd go for this change.
So, Alex, if you want you can commit the patch (of course after usual
testing).
I'd already tested it, but I've added some comments, so I gave it
another round of testing, and a ChangeLog entry.
Here's what I'm going to put in, barring objections. Regstrapped on
x86_64-linux-gnu.
Use the newly-added first_diff API for iteration. This hugely
simplifies the iterator type, that no longer saves internal state, and
largely simplifies and likely speeds up iteration, thanks to the use
of ctz.
OK for me. Thank you, Alex.
for gcc/ChangeLog
PR rtl-optimization/122767
* hard-reg-set.h (hard_reg_set_iterator): Simplify.
(hard_reg_set_iter_init): Likewise.
(hard_reg_set_iter_set): Likewise. Use first_diff.
(hard_reg_set_iter_next): Likewise.