https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112542
Bug ID: 112542
Summary: [14 Regression] Dead Code Elimination Regression since
r14-4280-gc3c6f30496d
Product: gcc
Version: 14.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: ---
https://godbolt.org/z/3vj8x1bPK
Given the following code:
void foo(void);
static short b = -1;
static int c, e;
static int *f = &c;
static char g;
static char(a)(char h, int i) {
if (!(((i) >= -1) && ((i) <= 0))) {
__builtin_unreachable();
}
return h || i ? h : h < 0;
}
static void(d)(unsigned h) {
if (!(((h) >= 0) && ((h) <= 4095017279))) {
foo();
}
}
int main() {
*f = b == 0;
g = a(c, c);
d(g);
d(4095017279);
if (e) b = 0;
a(0, b);
}
gcc-trunk -O3 does not eliminate the call to foo:
main:
xorl %eax, %eax
cmpw $0, b(%rip)
sete %al
movl %eax, c(%rip)
jne .L4
pushq %rax
call foo
xorl %eax, %eax
popq %rdx
ret
.L4:
xorl %eax, %eax
ret
gcc-13.2.0 -O3 eliminates the call to foo:
main:
xorl %eax, %eax
cmpw $0, b(%rip)
sete %al
movl %eax, c(%rip)
xorl %eax, %eax
ret
Bisects to r14-4280-gc3c6f30496d