On Wed, Jun 10, 2026 at 07:38:14PM +0530, [email protected] wrote:
> From: Soumya AR <[email protected]>
> 
> This patch adds a new pass that recognises compare-and-swap loops implementing
> an atomic fetch min or max, and replaces each one with a single
> IFN_ATOMIC_FETCH_MINMAX call.  This allows us to emit a target optab for fetch
> min/max, if available.

This definitely shouldn't be done in a separate pass.
Pattern match it where similar stuff is usually pattern-matched, forwprop,
phiopt, widening_mul, etc.
I think it shouldn't be matched if there is no corresponding optab
(especially if it is matched after IPA).  I think it should be done after
IPA, while your current location is after einline and so if you're lucky
you get some possible inlines around the atomics inlined, you might not
get all of those until after IPA.

        Jakub

Reply via email to