https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103257
Bug ID: 103257 Summary: [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0) Product: gcc Version: 12.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: --- cat case.c void foo(void); unsigned b, c; static short a(short e, short f) { return e * f; } int main() { if (a(1 ^ ((0, 0) ^ 1 && b) <= b, c)) foo(); c = 0; } 11.2.0 at -O3 can eliminate the call to foo but trunk at -O3 cannot: gcc11 case.c -S -O3 -o /dev/stdout main: .LFB1: .cfi_startproc movl b(%rip), %eax xorl %edx, %edx testl %eax, %eax setne %dl cmpl %edx, %eax movl $0, %eax cmovb c(%rip), %ax testw %ax, %ax jne .L11 movl $0, c(%rip) xorl %eax, %eax ret .L11: pushq %rax .cfi_def_cfa_offset 16 call foo xorl %edx, %edx xorl %eax, %eax movl %edx, c(%rip) popq %rcx .cfi_def_cfa_offset 8 ret .cfi_endproc gcc-trunk -v Target: x86_64-pc-linux-gnu Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 12.0.0 20211115 (experimental) (GCC) It started with https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=0288527f47cec6698b31ccb3210816415506009e