From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8096E3858CDB; Mon, 18 Sep 2023 09:50:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8096E3858CDB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1695030653; bh=z+ONnf6hzUvZsdGnzKMiu5+M321UlxkKfGPTYIjDcKk=; h=From:To:Subject:Date:From; b=L4MHEAhL6dy0Ugt4v1xFLybRg3zqD0K/9L9lFWoM2EP3lZ39MDqPzvtYgVJXvvBE1 IC0ZUUtrrdLhXq4QYVfveoU9NNSOzJ4pTk/BQKiblxjB2k+A+Sbl8Hqcac0xkPqTbx ymhShpo2dpKvDKoicUX3j4YTjK/VRQZLd0FdCXSY= From: "theodort at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111457] New: [14 Regression] Dead Code Elimination Regression since r14-3407-g936a12331a2 Date: Mon, 18 Sep 2023 09:50:53 +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=3D111457 Bug ID: 111457 Summary: [14 Regression] Dead Code Elimination Regression since r14-3407-g936a12331a2 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/j4M8z8MzK Given the following code: void foo(void); static int a, b, c, d, h; static short i; static void e(int f) { int g =3D -16; for (; g !=3D -6; g =3D g + 5) { b =3D 6; if (!(((f) >=3D 1) && ((f) <=3D 26))) { __builtin_unreachable(); } f =3D 0; for (; f < 26; ++f) if (a) { foo(); break; } d =3D 0; } } int main() { a =3D 0; e(0 =3D=3D i); h =3D d; c =3D b; } gcc-trunk -O2 does not eliminate the call to foo: main: movl $0, a(%rip) pushq %rbx movl $2, %ebx .L3: movl $6, b(%rip) movl a(%rip), %eax testl %eax, %eax je .L2 call foo .L2: movl $0, d(%rip) cmpl $1, %ebx jne .L4 xorl %eax, %eax popq %rbx ret .p2align 4,,10 .p2align 3 .L4: movl $1, %ebx jmp .L3 gcc-13.2.0 -O2 eliminates the call to foo: main: movl $0, a(%rip) xorl %eax, %eax movl $6, b(%rip) movl $0, d(%rip) ret Bisects to r14-3407-g936a12331a2=