From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1A45338460AD; Tue, 10 Jan 2023 13:03:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1A45338460AD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673355784; bh=VrVtYjXypyyvuo8yS8QCw2ajokKtZ2GAr87vvaMifZw=; h=From:To:Subject:Date:From; b=NWb7UgAuZnaSWGW1ojUvVRM4loUIAIRAjsxwvosUVr5fRYc6v+kSQedJitNwbE5Sj BHbAlXCWbrgK/R53N35xQ2v5TJeaGfZOg7JKVW2IVY7DZNG25pj/noJcdjVE5Hv5Yt 5tMUX+ciqhZFZACaBOIZ8k9csLBg9y3ZMc/jCXhI= From: "yann at ywg dot ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/108358] New: Dead Code Elimination Regression at -Os (trunk vs. 12.2.0) Date: Tue, 10 Jan 2023 13:03:03 +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=3D108358 Bug ID: 108358 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 54233 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D54233&action=3Dedit presented code as file cat case.c #25 struct a { int b; int c; short d; int e; int f; }; struct g { struct a f; struct a h; }; int i; void foo(); void bar31_(void); int main() { struct g j, l =3D {2, 1, 6, 1, 1, 7, 5, 1, 0, 1}; for (; i; ++i) bar31_(); j =3D l; struct g m =3D j; struct g k =3D m; if (k.h.b) ; else foo(); } `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: .LFB0: .cfi_startproc pushq %rbx .cfi_def_cfa_offset 16 .cfi_offset 3, -16 movl $.LC0, %esi movl $10, %ecx subq $80, %rsp .cfi_def_cfa_offset 96 leaq 40(%rsp), %rdi leaq 40(%rsp), %rbx rep movsl .L2: cmpl $0, i(%rip) je .L7 call bar31_ incl i(%rip) jmp .L2 .L7: movq %rsp, %rdi movl $10, %ecx movq %rbx, %rsi rep movsl cmpl $0, 20(%rsp) jne .L4 xorl %eax, %eax call foo .L4: addq $80, %rsp .cfi_def_cfa_offset 16 xorl %eax, %eax popq %rbx .cfi_def_cfa_offset 8 ret ---------- END OUTPUT --------- `gcc-releases/gcc-12.2.0 -Os -S -o /dev/stdout case.c` --------- OUTPUT --------- main: .LFB0: .cfi_startproc cmpl $0, i(%rip) jne .L7 xorl %eax, %eax ret .L7: pushq %rax .cfi_def_cfa_offset 16 .L3: call bar31_ incl i(%rip) cmpl $0, i(%rip) jne .L3 xorl %eax, %eax popq %rdx .cfi_def_cfa_offset 8 ret ---------- END OUTPUT --------- Bisects to: https://gcc.gnu.org/git/?p=3Dgcc.git;a=3Dcommit;h=3Df6c168f8c06047bfaa3005e= 570126831b8855dcc=