https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103069
--- Comment #13 from Hongyu Wang <wwwhhhyyy333 at gmail dot com> --- All above glibc cases are now both relaxed by an load/cmp to skip cmpxchg under -mrelax-cmpxchg-loop, but for > do > { > flags = THREAD_GETMEM (self, cancelhandling); > newval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, > flags & ~SETXID_BITMASK, flags); > } > while (flags != newval); If we want to optimize it to lock btc, we need to know the cmpxchg lies in a loop. So it may require an extra pass to do further analysis and optimize, which is not a good idea to do in stage 4.