On Fri, 28 Nov 2025, Alexandre Oliva wrote: > On Nov 27, 2025, Richard Biener <[email protected]> wrote: > > > I'm not sure I like using hard_reg_set_first_diff, esp. when > > that ends up using the array version this looks like a step > > backwards? > > Why? The performed operations are essentially the same, the exception > being the use of masking rather than shifts with caching. The former > doesn't carry the implicit and undocumented assumption that neither the > HARD_REG_SET nor the regno can change during the iteration, but we don't > seem to rely on that. > > Now, if we want to stick to those assumptions, the current iterator > implementation can be modified to use ffs or ctz instead. Would you > prefer that?
I guess my dislike is from the abstraction that makes it less obvious what happens in this fast path ... but as you both agree on this approach I'm OK with it. I'd had expected a manual adaption of ctz/ffs use in the iterator to be more "obviously" better. Did you look at the actual code generation difference for an example iteration for the case where HARD_REG_SET is not just a single uint64? Richard. -- Richard Biener <[email protected]> SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg, Germany; GF: Jochen Jaser, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)
