From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 85D313858C33; Wed, 28 Jun 2023 10:21:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 85D313858C33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687947675; bh=aFTO9wgK+YVKSjU+/FXx5hZ58BOs+z6RJ6I342m+dFM=; h=From:To:Subject:Date:From; b=I6BA44LKQVjF38ZnUeEI80IxL6kwdzvRWfhwPO0F9tBhS3yIPaCEv7Qh8sXGZcHMO drIWiyeOg27iu9eCckeMTInBPePD9A/XhTUQ0Rcs23AI7kf96bS78BcOreZRzlxMoW vLgdlMVHYAE+cNV3VnrWxs/3izOIkQ62duKGERUY= From: "theodort at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110450] New: [14 Regression] Dead Code Elimination Regression at -O2 since r14-261-g0ef3756adf0 Date: Wed, 28 Jun 2023 10:21:15 +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=3D110450 Bug ID: 110450 Summary: [14 Regression] Dead Code Elimination Regression at -O2 since r14-261-g0ef3756adf0 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/KqcYxfevj Given the following code: void foo(void); static int a =3D 1; static int *b =3D &a, *c =3D &a; static short d, e; static char f =3D 11; static char(g)(char h, int i) { return h << i; } int main() { if (f) *c =3D g(0 >=3D a, 3); e =3D *c; d =3D e % f; if (d) { __builtin_unreachable(); } else if (*b) foo(); ; } gcc-trunk -O2 does not eliminate the call to foo: main: movl a(%rip), %eax xorl %edx, %edx testl %eax, %eax setle %dl leal 0(,%rdx,8), %edx movl %edx, a(%rip) jle .L8 xorl %eax, %eax ret .L8: pushq %rax call foo xorl %eax, %eax popq %rdx ret gcc-13.1.0 -O2 eliminates the call to foo: main: movl a(%rip), %edx xorl %eax, %eax testl %edx, %edx setle %al leal 0(,%rax,8), %eax movl %eax, a(%rip) xorl %eax, %eax ret Bisects to r14-261-g0ef3756adf0=