https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105834
Bug ID: 105834
Summary: Dead Code Elimination Regression at -O2 (trunk vs.
12.1.0)
Product: gcc
Version: 13.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
static int a, b;
void foo();
int main() {
for (int c = 0; c < 2; c = c + (unsigned)3)
if (a)
for (;;)
if (c > 0)
b = 0;
if (b)
foo();
}
`gcc-1982fe2692b6c3b7f969ffc4edac59f9d4359e91 (trunk) -O2` can not eliminate
`foo` but `gcc-releases/gcc-12.1.0 -O2` can.
`gcc-1982fe2692b6c3b7f969ffc4edac59f9d4359e91 (trunk) -O2 -S -o /dev/stdout
case.c`
--------- OUTPUT ---------
main:
.LFB0:
.cfi_startproc
movl b(%rip), %ecx
testl %ecx, %ecx
jne .L8
xorl %eax, %eax
ret
.L8:
pushq %rax
.cfi_def_cfa_offset 16
xorl %eax, %eax
call foo
xorl %eax, %eax
popq %rdx
.cfi_def_cfa_offset 8
ret
---------- END OUTPUT ---------
`gcc-releases/gcc-12.1.0 -O2 -S -o /dev/stdout case.c`
--------- OUTPUT ---------
main:
.LFB0:
.cfi_startproc
xorl %eax, %eax
ret
---------- END OUTPUT ---------
Bisects to:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=98e475a8f58ca3ba6e9bd5c9276efce4236f5d26