https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111294
Bug ID: 111294 Summary: [14 Regression] Missed Dead Code Elimination since r14-573-g69f1a8af45d 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/7GTzj8Ea1 Given the following code: void foo(void); static short a; static int b, c, d; static int *e, *f = &d; static int **g = &e; static unsigned char h; static short(i)(short j, int k) { return j > k ?: j; } static char l() { if (a) return b; return c; } int main() { b = 0; for (; b < 5; ++b) ; h = l(); if (a ^ 3 >= i(h, 11)) a = 0; else { *g = f; if (e == &d & b) { __builtin_unreachable(); } else foo(); ; } } gcc-trunk -Os does not eliminate the call to foo: main: movswl a(%rip), %eax xorl %edx, %edx movl $5, b(%rip) testw %ax, %ax je .L2 movl $5, %edx .L2: cmpl $3, %edx setle %dl movzbl %dl, %edx cmpl %edx, %eax je .L3 movw $0, a(%rip) xorl %eax, %eax ret .L3: pushq %rax movq $d, e(%rip) call foo xorl %eax, %eax popq %rdx ret gcc-13.2.0 -Os eliminates the call to foo: main: movl $5, b(%rip) xorl %eax, %eax movw $0, a(%rip) ret Bisects to r14-573-g69f1a8af45d