https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110991
Bug ID: 110991 Summary: [14 Regression] Dead Code Elimination Regression at -O2 since r14-1135-gc53f51005de Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: scherrer.sv at gmail dot com Target Milestone: --- static unsigned char a; static char b; void foo(void); int main() { a = 25; for (; a > 13; --a) b = a > 127 ?: a << 3; if (!b) foo(); } gcc-3a13884b23a (trunk) -O2 cannot eliminate the call to foo but gcc-releases/gcc-13.1.0 -O2 can. ----------------------------------------------------------------------- gcc-3a13884b23ae32b43d56d68a9c6bd4ce53d60017 -O2 case.c -S -o case.s --------- OUTPUT --------- main: .LFB0: .cfi_startproc movd .LC0(%rip), %xmm0 movd .LC1(%rip), %xmm1 xorl %eax, %eax .L2: addl $1, %eax movdqa %xmm0, %xmm2 paddb %xmm1, %xmm0 cmpl $3, %eax jne .L2 movdqa %xmm2, %xmm0 movb $13, a(%rip) paddb %xmm2, %xmm0 paddb %xmm0, %xmm0 movdqa %xmm0, %xmm1 paddb %xmm0, %xmm1 pxor %xmm0, %xmm0 pcmpgtb %xmm2, %xmm0 movd .LC2(%rip), %xmm2 pand %xmm0, %xmm2 pandn %xmm1, %xmm0 por %xmm2, %xmm0 movd %xmm0, %eax sarl $24, %eax movb %al, b(%rip) testb %al, %al je .L10 xorl %eax, %eax ret .L10: pushq %rax .cfi_def_cfa_offset 16 call foo xorl %eax, %eax popq %rdx .cfi_def_cfa_offset 8 ret ---------- END OUTPUT --------- ----------------------------------------------------------------------- gcc-2b98cc24d6af0432a74f6dad1c722ce21c1f7458 -O2 case.c -S -o case.s --------- OUTPUT --------- main: .LFB0: .cfi_startproc movb $112, b(%rip) xorl %eax, %eax movb $13, a(%rip) ret ---------- END OUTPUT --------- ----------------------------------------------------------------------- Bisects to r14-1135-gc53f51005de