https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106293
Yann Girsberger <yann at ywg dot ch> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |yann at ywg dot ch
--- Comment #6 from Yann Girsberger <yann at ywg dot ch> ---
I found a DCE Regression in trunk that bisects to the same commit as in the
original report.
It seems to be present in -Ofast and -O2.
Let me know if this should be a new report.
cat case.c #14
int a;
static long b = 4073709551612, d;
short c;
void foo();
static char e(int **f) {
**f = 0;
if (a) {
unsigned long *g = &b;
unsigned long **h = &g;
for (; d;) {
foo();
for (; c;) {
unsigned long ***i = &h;
}
}
}
return 1;
}
int main() {
int *j = &a;
e(&j);
if (b <= 0)
foo();
}
`gcc-cb93c5f8008b95743b741d6f1842f9be50c6985c (trunk) -O2` can not eliminate
`foo` but `gcc-releases/gcc-12.2.0 -O2` can.
`gcc-cb93c5f8008b95743b741d6f1842f9be50c6985c (trunk) -O2 -S -o /dev/stdout
case.c`
--------- OUTPUT ---------
main:
.LFB1:
.cfi_startproc
cmpq $0, b(%rip)
movl $0, a(%rip)
jle .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.2.0 -O2 -S -o /dev/stdout case.c`
--------- OUTPUT ---------
main:
.LFB1:
.cfi_startproc
movl $0, a(%rip)
xorl %eax, %eax
ret
---------- END OUTPUT ---------
Bisects to:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d2a898666609452ef79a14feae1cadc3538e4b45