https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110768
Bug ID: 110768 Summary: [14 Regression] Dead Code Elimination Regression since r14-2623-gc11a3aedec2 Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: theodort at inf dot ethz.ch Target Milestone: --- https://godbolt.org/z/GsTMz1G9c Given the following code: void foo(void); static int a, b; int main() { { short c = 45127; char d; b = 0; for (; b <= 3; b++) { if (b) continue; d = 0; for (; d <= 3; d++) { if (!(((c) >= -20409) && ((c) <= 1))) { __builtin_unreachable(); } if (~(0 == a) & 1) return b; c = 0; for (; c <= 0; c++) a = 3; } } foo(); } } gcc-trunk -Os does not eliminate the call to foo: main: xorl %r9d, %r9d movl a(%rip), %eax xorl %edx, %edx xorl %esi, %esi movl %r9d, b(%rip) xorl %ecx, %ecx .L2: cmpl $4, %edx je .L31 testl %edx, %edx jne .L3 testl %eax, %eax je .L4 .L24: testb %sil, %sil je .L5 xorl %r8d, %r8d movl %r8d, b(%rip) .L5: testb %cl, %cl je .L27 movl %eax, a(%rip) jmp .L27 .L4: movl $3, %eax movb $1, %cl jmp .L24 .L3: incl %edx movb $1, %sil jmp .L2 .L31: pushq %rdi testb %sil, %sil je .L9 movl $4, b(%rip) .L9: testb %cl, %cl je .L10 movl %eax, a(%rip) .L10: call foo xorl %eax, %eax popq %rdx ret .L27: xorl %eax, %eax ret gcc-13.1.0 -Os eliminates the call to foo: main: xorl %eax, %eax cmpl $0, a(%rip) movl %eax, b(%rip) jne .L2 movl $3, a(%rip) .L2: xorl %eax, %eax ret Bisects to r14-2623-gc11a3aedec2