From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6E81D3882644; Fri, 30 Jun 2023 16:34:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6E81D3882644 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688142879; bh=yfsZV0lyv89P9mFzK68rjkeEbwLktl5qszspjgluLaM=; h=From:To:Subject:Date:From; b=RJJkxXKWjvvksvrp+K+/izyC0yWrtMtonIsSzVK8/hIA81Ey6Tlsoogp5XmORIbH0 0ZXBDN6xyMzhkSDvUQKnJ/gItXhZru3RGMqOBtOirjq6uM/quPkdEpCktozeJu5HKn +TEMfJkHYELHFB0301iAR3k+c5dnbYtNS95SXEyo= From: "theodort at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110503] New: [13/14 Regression] Dead Code Elimination Regression at -O3 since r13-322-g7f04b0d786e Date: Fri, 30 Jun 2023 16: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: 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=3D110503 Bug ID: 110503 Summary: [13/14 Regression] Dead Code Elimination Regression at -O3 since r13-322-g7f04b0d786e 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/h3G76EEW5 Given the following code: void foo(void); static int f =3D 10, g, h; static int *i =3D &g, *j =3D &f, *k =3D &h; static char(a)(int b) { if (!(((b) >=3D 1) && ((b) <=3D 3))) { __builtin_unreachable(); } return 0; } static char(c)(char d, char e) { return d % e; } static void l() { char m, n; unsigned o; int *p =3D &g; o =3D -19; for (; o > 22; o =3D o + 8) { int *q =3D &g; g =3D 30; unsigned char d =3D 60, e =3D o; m =3D d / e; if ((0 || *q) & m =3D=3D 0) ; else { foo(); n =3D c(0 !=3D p, *p); a(n); *q =3D 0; } } *i =3D a(3); *k =3D 0 !=3D *j; } int main() { l(); a(h); } gcc-trunk -O3 does not eliminate the call to foo: main: pushq %rbx movl $-19, %ebx jmp .L5 .p2align 4,,10 .p2align 3 .L8: call foo addl $8, %ebx .L5: movl $30, g(%rip) cmpb $60, %bl jbe .L8 addl $8, %ebx cmpl $5, %ebx jne .L5 movl f(%rip), %edx xorl %eax, %eax popq %rbx movl $0, g(%rip) testl %edx, %edx setne %al movl %eax, h(%rip) xorl %eax, %eax ret gcc-12.3.0 -O3 eliminates the call to foo: main: movl f(%rip), %edx xorl %eax, %eax movl $0, g(%rip) testl %edx, %edx setne %al movl %eax, h(%rip) xorl %eax, %eax ret Bisects to r13-322-g7f04b0d786e=