From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8C9103858D37; Wed, 2 Aug 2023 12:34:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8C9103858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1690979679; bh=JKGHxizBqQbQUbDOFQGjQ9PzgTsUYTqtYpl7RB2uc/c=; h=From:To:Subject:Date:From; b=GNAMlsHMioNY/IzznjkaJcGUOTLfL9+00zrjg8eoZsK+qIm/+hv/mxsAtqI/i+PML VdXfzcDZUML3nlNAKZ1ktE2e31WTO0rMnGLqYwezM6k0swZU9nOQYmeynBikhqFCe4 tHU81ynYZX1qj9Wf+6G5Y+1HCxvo3hEXw/jLY5Bg= From: "scherrer.sv at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110873] New: [14 Regression] Dead Code Elimination Regression at -O2 since r14-376-g47a76439911 Date: Wed, 02 Aug 2023 12:34:39 +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: scherrer.sv at gmail dot com 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=3D110873 Bug ID: 110873 Summary: [14 Regression] Dead Code Elimination Regression at -O2 since r14-376-g47a76439911 Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: scherrer.sv at gmail dot com Target Milestone: --- static int b; static short c; static char d; static int *e =3D &b; void foo(void);=20=20 void bar110_(void); static char(a)(char f, char g) { return f + g; } int main() { *e =3D 3; unsigned char h; c =3D 0; i: if (!b) foo(); h =3D -25; for (; h >=3D 7; h =3D a(h, 6)) for (; d; d--) ; if (!(h >=3D 5)) bar110_(); if (c) goto i; } ----------------------------------------------------------------------- gcc-68c3aa7510b (trunk) -O2 cannot eliminate the call to foo but gcc-releases/gcc-13.1.0 -O2 can ----------------------------------------------------------------------- gcc-68c3aa7510b2f45f44379ecd77e97c88780a84ed -O2 case.c -S -o case.s --------- OUTPUT --------- main: .LFB1: .cfi_startproc movl $3, b(%rip) xorl %esi, %esi movw %si, c(%rip) .L11: cmpb $0, d(%rip) je .L13 movb $0, d(%rip) .L13: cmpw $0, c(%rip) je .L15 movl b(%rip), %eax testl %eax, %eax jne .L11 subq $8, %rsp .cfi_def_cfa_offset 16 .L6: call foo .L2: cmpb $0, d(%rip) je .L4 movb $0, d(%rip) .L4: cmpw $0, c(%rip) je .L5 movl b(%rip), %ecx testl %ecx, %ecx jne .L2 jmp .L6 .L15: .cfi_def_cfa_offset 8 xorl %eax, %eax ret .L5: .cfi_def_cfa_offset 16 xorl %eax, %eax popq %rdx .cfi_def_cfa_offset 8 ret ---------- END OUTPUT --------- ----------------------------------------------------------------------- gcc-2b98cc24d6af0432a74f6dad1c722ce21c1f7458 -O2 case.c -S -o case.s --------- OUTPUT --------- main: .LFB1: .cfi_startproc movl $3, b(%rip) xorl %eax, %eax cmpb $0, d(%rip) movw %ax, c(%rip) je .L3 movb $0, d(%rip) .L3: xorl %eax, %eax ret ---------- END OUTPUT --------- ----------------------------------------------------------------------- Bisects to r14-376-g47a76439911=