https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110942
Bug ID: 110942
Summary: [14 Regression] Dead Code Elimination Regression at
-O3 since r14-1165-g257c2be7ff8
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 int b, c;
static short d;
static char e;
void bar49_(void);
void bar115_(void);
void bar42_(void);
void foo(void);
static short(a)(short f, short g) { return f + g; }
static int h() {
short i = 0;
char j;
int k;
l:
k = 0;
if (i)
bar42_();
i = 0;
for (; i != 8; i = a(i, 8)) {
if (e)
bar49_();
if (0 >= i)
c = 0;
if (!k) {
j = 6;
for (; j >= 0; j--) {
k = 0;
for (; k <= 0; k++) {
if (!(j >= 5))
bar115_();
for (; d; d = 0) {
if (!j)
foo();
if (j)
break;
}
if (i)
break;
}
if (c)
return j;
c = 2;
if (b)
goto l;
}
}
}
return 0;
}
int main() { h(); }
gcc-25c4b1620eb (trunk) -O3 cannot eliminate the call to foo but
gcc-releases/gcc-13.1.0 -O3 can.
-----------------------------------------------------------------------
gcc-25c4b1620ebc10fceabd86a34fdbbaf8037e7e82 -O3 case.c -S -o case.s
--------- OUTPUT ---------
main:
.LFB2:
.cfi_startproc
pushq %rbx
.cfi_def_cfa_offset 16
.cfi_offset 3, -16
xorl %eax, %eax
movl $6, %ebx
.L2:
movl %eax, c(%rip)
cmpb $4, %bl
jne .L18
.L7:
call bar115_
cmpw $0, d(%rip)
je .L8
testb %bl, %bl
jne .L8
call foo
movl c(%rip), %edx
xorl %eax, %eax
movw %ax, d(%rip)
testl %edx, %edx
jne .L5
movl $2, c(%rip)
.L5:
xorl %eax, %eax
popq %rbx
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L18:
.cfi_restore_state
testl %eax, %eax
jne .L5
subl $1, %ebx
movl $2, %eax
jmp .L2
.L8:
cmpl $0, c(%rip)
jne .L5
movl $2, c(%rip)
subl $1, %ebx
cmpb $-1, %bl
jne .L7
jmp .L5
---------- END OUTPUT ---------
-----------------------------------------------------------------------
gcc-2b98cc24d6af0432a74f6dad1c722ce21c1f7458 -O3 case.c -S -o case.s
--------- OUTPUT ---------
main:
.LFB2:
.cfi_startproc
movl $2, c(%rip)
xorl %eax, %eax
ret
---------- END OUTPUT ---------
-----------------------------------------------------------------------
Bisects to r14-1165-g257c2be7ff8