From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 13A623858C5E; Thu, 3 Aug 2023 16:01:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 13A623858C5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691078469; bh=F0wnr4seGyla0pOR2+2MfLu6iyjhbFst6AWMI7aW60I=; h=From:To:Subject:Date:From; b=AGCGOjkLhdVlH05jTKLGDbk3wYn4xH4z5jpd1muhp4SsE1vKHpI8wc69Uyki1T0AU TDXtCXjMvjbXul2qrHmeWxta9WOHIp3ENXdaf5NOl9SBXbdQQwRe3t4Mtzgw4UvIU8 tH8PtWC2XgNfCIJkh6w8E/thfV0oxkLcpIA8xgYo= From: "theodort at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110891] New: [14 Regression] Dead Code Elimination Regression since r14-2674-gd0de3bf9175 Date: Thu, 03 Aug 2023 16:01:08 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: theodort at inf dot ethz.ch X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110891 Bug ID: 110891 Summary: [14 Regression] Dead Code Elimination Regression since r14-2674-gd0de3bf9175 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/njdE3xof4 Given the following code: void foo(void); static int a, c =3D 7, d, o, q; static int *b =3D &a, *f, *j =3D &d, *n =3D &c, *ae; static short e, m; static short *i =3D &e; static char r; void __assert_fail(char *, char *, int, char *) __attribute__((__noreturn__= )); static const short g(); static void h(); static int *k(int) { (*i)++; *j ^=3D *b; return &a; } static void l(unsigned p) { int *aa =3D &o; h(); o =3D 5 ^ g() && p; if (f =3D=3D &d || f =3D=3D &c || f =3D=3D &a) ; else { foo(); __assert_fail("", "", 3, __PRETTY_FUNCTION__); } *aa ^=3D *n; if (*aa) if (!(((p) >=3D 0) && ((p) <=3D 0))) { __builtin_unreachable(); } k(p); } static const short g() { return q; } static void h() { unsigned ag =3D c; d =3D ag > r ? ag : 0; ae =3D k(c); f =3D ae; if (ae =3D=3D &d || ae =3D=3D &c || ae =3D=3D &a) ; else __assert_fail("", "", 4, __PRETTY_FUNCTION__); } int main() { l(a); m || (*b |=3D 64); *b &=3D 5; } gcc-trunk -O2 does not eliminate the call to foo: main: subq $8, %rsp movl c(%rip), %eax movl %eax, d(%rip) call k.isra.0 cmpq $c, %rax movq %rax, f(%rip) sete %cl cmpq $a, %rax sete %dil cmpq $d, %rax sete %dl orb %cl, %dl jne .L4 testb %dil, %dil je .L15 .L4: cmpq $d, %rax je .L6 testb %cl, %cl jne .L6 testb %dil, %dil je .L16 .L6: call k.isra.0 andl $5, a(%rip) xorl %eax, %eax addq $8, %rsp ret .L16: call foo movl $.LC0, %esi movl $__PRETTY_FUNCTION__.1, %ecx movl $3, %edx movq %rsi, %rdi call __assert_fail .L15: movl $.LC0, %esi movl $__PRETTY_FUNCTION__.0, %ecx movl $4, %edx movq %rsi, %rdi call __assert_fail gcc-13.2.0 -O2 eliminates the call to foo: main: subq $8, %rsp movl c(%rip), %eax movl %eax, d(%rip) call k.isra.0 cmpq $c, %rax movq %rax, f(%rip) sete %dl cmpq $d, %rax sete %cl orb %cl, %dl jne .L4 cmpq $a, %rax jne .L6 .L4: call k.isra.0 andl $5, a(%rip) xorl %eax, %eax addq $8, %rsp ret .L6: movl $.LC0, %esi movl $__PRETTY_FUNCTION__.0, %ecx movl $4, %edx movq %rsi, %rdi call __assert_fail Bisects to r14-2674-gd0de3bf9175=