From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 90D753858CDA; Tue, 10 Jan 2023 12:41:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 90D753858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673354487; bh=d4E7hlXq8VwRYVFvIQ1DWFqLsCkBmm7NscZOTOgaIUA=; h=From:To:Subject:Date:From; b=LkY9otMJE+Pu/6B+vXCp+6MULzHANtCWOH5e/Z7/C0lVrbTFJyTAAJrrsJervGN5k StqZvS10VVF2nKjc3dT5giB1I39ftsgYRUoAdXWFz4lzeE3d2SHji3Ed9+GdzoCvxj t1oRLx2V7qRVAU2FIY6vsMfvBYC1a0b25cc3CfdI= From: "yann at ywg dot ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/108354] New: Dead Code Elimination Regression at -O2 (trunk vs. 12.2.0) Date: Tue, 10 Jan 2023 12:41:27 +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=3D108354 Bug ID: 108354 Summary: Dead Code Elimination Regression at -O2 (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 54229 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D54229&action=3Dedit presented code as file cat case.c #617 int b; int *c; int e; static int *f =3D &e; int g; void foo(); short(a)(short h, short i) { return h - i; } int(d)(int h) { return h =3D=3D 83647 ? 0 : -h; } int main() { short j; int *k =3D &e, *l =3D &b; *f =3D 0 =3D=3D c; j =3D a(0 !=3D 2, *k); if (d(j ^ (0 =3D=3D l || *k)) !=3D *k) ; else foo(); c =3D &g; } `gcc-cb93c5f8008b95743b741d6f1842f9be50c6985c (trunk) -O2` can not eliminate `foo` but `gcc-releases/gcc-12.2.0 -O2` can. `gcc-cb93c5f8008b95743b741d6f1842f9be50c6985c (trunk) -O2 -S -o /dev/stdout case.c` --------- OUTPUT --------- main: .LFB2: .cfi_startproc xorl %eax, %eax cmpq $0, c(%rip) setne %dl sete %al movzbl %dl, %edx movl %eax, e(%rip) orl %eax, %edx je .L12 movq $g, c(%rip) xorl %eax, %eax ret .L12: pushq %rax .cfi_def_cfa_offset 16 xorl %eax, %eax call foo xorl %eax, %eax movq $g, c(%rip) popq %rdx .cfi_def_cfa_offset 8 ret ---------- END OUTPUT --------- `gcc-releases/gcc-12.2.0 -O2 -S -o /dev/stdout case.c` --------- OUTPUT --------- main: .LFB2: .cfi_startproc xorl %eax, %eax cmpq $0, c(%rip) movq $g, c(%rip) sete %al movl %eax, e(%rip) xorl %eax, %eax ret ---------- END OUTPUT --------- Bisects to: https://gcc.gnu.org/git/?p=3Dgcc.git;a=3Dcommit;h=3Db3e98eb3396e16ae8b20c94= 916bc2bd7862d2c97=