https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111326
Bug ID: 111326 Summary: [14 Regression] Dead Code Elimination Regression since r14-376-g47a76439911 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/fv3szWMTE Given the following code: void foo(void); static int a = 253, d, e, f, h, i, k; static char j, m; static short l, n; static char(o)(char b, char c) { return b + c; } void(p)(int); short(q)(short); static short(r)(int g) { if (!(((g) >= 253) && ((g) <= 253))) { __builtin_unreachable(); } return 0; } static void s(char ab, short) { int ac; ab = 27; for (; ab > 13; ab = ab - 9) { j |= 10 | ac; e = 0; if (o(ab ^ a, d)) { --l; f = 0; if (a) ; else { p(i); k ^= q(0); } i = 5; } else { ac = 0; for (; ac <= 38; ac = ac + 5) foo(); k = h &= 0 >= 0; n = 0; } } } static unsigned t() { s(m, a); if (l) ; else r(3); return f; } int main() { d = a; t(); r(a); printf("", e, n); } gcc-trunk -O3 does not eliminate the call to foo: main: pushq %rbp movl $253, %edx movl $27, %ebp pushq %rbx subq $8, %rsp movl $253, d(%rip) .L5: movl %ebp, %eax orb $42, j(%rip) movl $0, e(%rip) xorl $-3, %eax addb %dl, %al je .L6 subw $1, l(%rip) movl $0, f(%rip) movl $5, i(%rip) .L3: cmpb $18, %bpl je .L4 movl d(%rip), %edx movl $18, %ebp jmp .L5 .p2align 4,,10 .p2align 3 .L4: movswl n(%rip), %edx movl e(%rip), %esi movl $.LC0, %edi xorl %eax, %eax call printf addq $8, %rsp xorl %eax, %eax popq %rbx popq %rbp ret .L6: movl $8, %ebx .L2: call foo call foo subl $2, %ebx jne .L2 movw $0, n(%rip) movl h(%rip), %eax andl $1, %eax movl %eax, h(%rip) movl %eax, k(%rip) jmp .L3 gcc-13.2.0 -O3 eliminates the call to foo: main: subq $8, %rsp movswl n(%rip), %edx xorl %esi, %esi xorl %eax, %eax movl $.LC0, %edi orb $42, j(%rip) subw $2, l(%rip) movl $253, d(%rip) movl $0, e(%rip) movl $0, f(%rip) movl $5, i(%rip) call printf xorl %eax, %eax addq $8, %rsp ret Bisects to r14-376-g47a76439911