https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70821
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 38356 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38356&action=edit gcc7-pr70821.patch For -Os, the problem is that peephole2 pass first replaces the movl $-1, %eax instruction with orl $-1, %eax as the latter is 2 bytes shorter, and then the peephole2 for the atomic decrement + comparison doesn't trigger anymore.