https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111515
Bug ID: 111515
Summary: [14 Regression] Missed Dead Code Elimination since
r14-4089-gd45ddc2c04e
Product: gcc
Version: unknown
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/K9bbM4fc9
Given the following code:
void foo(void);
static struct a {
short b;
int c;
char d;
int e;
unsigned f;
} h, j, k = {0, 4274716299}, l, *aa = &j;
static char g;
static short i;
static int m, ah;
static int *ac = &j.e;
static void n(struct a o) {
int aj = o.c;
int *ak = &h.e;
*ak = g && aj;
if (!(((aj) >= 0) && ((aj) <= 4274716299))) {
__builtin_unreachable();
}
i = ah;
}
int main() {
n(l);
*aa = h;
m = *ac;
if (m < 10)
;
else
foo();
;
n(k);
}
gcc-trunk -O2 does not eliminate the call to foo:
main:
subq $8, %rsp
xorl %edi, %edi
call n.isra.0
movdqa h(%rip), %xmm0
movl h+16(%rip), %eax
movaps %xmm0, j(%rip)
cmpl $9, j+12(%rip)
movl %eax, j+16(%rip)
jg .L6
.L4:
movl $-20250997, %edi
xorl %eax, %eax
call n.isra.0
addq $8, %rsp
ret
.L6:
call foo
jmp .L4
gcc-13.2.0 -O2 eliminates the call to foo:
main:
movl $0, h+12(%rip)
movl h+16(%rip), %eax
movdqa h(%rip), %xmm0
movl %eax, j+16(%rip)
movaps %xmm0, j(%rip)
Bisects to r14-4089-gd45ddc2c04e