[Bug tree-optimization/108351] New: Dead Code Elimination Regression at -O3 (trunk vs. 12.2.0)
yann at ywg dot ch
gcc-bugzilla@gcc.gnu.org
Tue Jan 10 11:46:47 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108351
Bug ID: 108351
Summary: Dead Code Elimination Regression at -O3 (trunk vs.
12.2.0)
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: yann at ywg dot ch
Target Milestone: ---
Created attachment 54226
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54226&action=edit
case file
cat case.c #51
struct a {
int b;
} b;
static short c = 7, d, e, a, k;
int g;
struct a h;
int i;
int j;
void foo();
static struct a f(int l, unsigned short m) {
a = e;
k = d = j < i;
if (m)
return h;
foo();
return b;
}
int main() {
for (; g;)
f(1, c);
f(7, 7);
f(9, 7);
}
`gcc-cb93c5f8008b95743b741d6f1842f9be50c6985c (trunk) -O3` can not eliminate
`foo` but `gcc-releases/gcc-12.2.0 -O3` can.
`gcc-cb93c5f8008b95743b741d6f1842f9be50c6985c (trunk) -O3 -S -o /dev/stdout
case.c`
--------- OUTPUT ---------
f.isra.0:
.LFB3:
.cfi_startproc
testw %di, %di
je .L4
ret
.p2align 4,,10
.p2align 3
.L4:
xorl %eax, %eax
jmp foo
.cfi_endproc
.LFE3:
.size f.isra.0, .-f.isra.0
.section .text.startup,"ax",@progbits
.p2align 4
.globl main
.type main, @function
main:
.LFB1:
.cfi_startproc
movl g(%rip), %eax
testl %eax, %eax
je .L6
.L7:
jmp .L7
.p2align 4,,10
.p2align 3
.L6:
subq $8, %rsp
.cfi_def_cfa_offset 16
movl $7, %edi
call f.isra.0
movl $7, %edi
call f.isra.0
xorl %eax, %eax
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
---------- END OUTPUT ---------
`gcc-releases/gcc-12.2.0 -O3 -S -o /dev/stdout case.c`
--------- OUTPUT ---------
main:
.LFB1:
.cfi_startproc
movl g(%rip), %eax
testl %eax, %eax
je .L4
.L5:
jmp .L5
.p2align 4,,10
.p2align 3
.L4:
xorl %eax, %eax
ret
---------- END OUTPUT ---------
Bisects to:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=feeb0d68f1c7085199c3734e6517a3a4b58309ef
More information about the Gcc-bugs
mailing list