From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id F19653858C52; Tue, 10 Jan 2023 13:10:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F19653858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673356243; bh=9SpB1g3yE2eWm2sKLVfyMvdeUwdJJO3/xoR10/mUmT8=; h=From:To:Subject:Date:From; b=Xs298iFOYjlUhfj8WFqcZE3DqPey+bt1TL/9HdC32eF01+819VnFgqPMMmfSsjhns HlWKvK7Xnmg3rwvTeygrTKYFhLgEoPbXrGmV9Y50AzmNuIsw8HL5lDkY8mAs0fZuLX X0FOrbiX7lZTa5edWN5QCnSU+YIDDjV9pMsDp3DQ= From: "yann at ywg dot ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/108360] New: Dead Code Elimination Regression at -Os (trunk vs. 12.2.0) Date: Tue, 10 Jan 2023 13:10:43 +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: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: yann at ywg dot 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 attachments.created 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=3D108360 Bug ID: 108360 Summary: Dead Code Elimination Regression at -Os (trunk vs. 12.2.0) Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: yann at ywg dot ch Target Milestone: --- Created attachment 54235 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D54235&action=3Dedit case.c as file cat case.c #321 static short b, c; unsigned char e; char f; void foo(); short(a)(short h, short i) { return h + i; } static short(d)(short h, int i) { return h >=3D 32 || h > 7 >> i ? h : h <<= i; } unsigned g(short h, short i) { return h + i; } int main() { short j, k =3D -1; c =3D a(0 >=3D b, k); f =3D c <=3D 0xD315BEF1; e =3D f << 4; j =3D d(e, 5); if (3 >=3D g(j =3D=3D b, k)) foo(); b =3D 0; } `gcc-cb93c5f8008b95743b741d6f1842f9be50c6985c (trunk) -Os` can not eliminate `foo` but `gcc-releases/gcc-12.2.0 -Os` can. `gcc-cb93c5f8008b95743b741d6f1842f9be50c6985c (trunk) -Os -S -o /dev/stdout case.c` --------- OUTPUT --------- main: .LFB3: .cfi_startproc movw b(%rip), %cx xorl %edx, %edx testw %cx, %cx setle %dl movl %edx, %eax movb %dl, f(%rip) sall $4, %eax movb %al, e(%rip) movzbl %al, %eax testw %dx, %dx jne .L4 sall $5, %eax .L4: cmpw %ax, %cx jne .L7 pushq %rax .cfi_def_cfa_offset 16 xorl %eax, %eax call foo xorl %eax, %eax movw $0, b(%rip) popq %rdx .cfi_def_cfa_offset 8 ret .L7: movw $0, b(%rip) xorl %eax, %eax ret ---------- END OUTPUT --------- `gcc-releases/gcc-12.2.0 -Os -S -o /dev/stdout case.c` --------- OUTPUT --------- main: .LFB3: .cfi_startproc xorl %eax, %eax cmpw $0, b(%rip) movw $0, b(%rip) setle %al movb %al, f(%rip) sall $4, %eax movb %al, e(%rip) xorl %eax, %eax ret ---------- END OUTPUT --------- Bisects to: https://gcc.gnu.org/git/?p=3Dgcc.git;a=3Dcommit;h=3D418b71c0d535bf91df78bad= 2e198c57934682eaa=