From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 592A63858C20; Thu, 8 Jun 2023 14:07:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 592A63858C20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686233222; bh=Ab1BI1XC2E9iZYVi7/e46+NQoFP/3k1VVDmgux3SLSo=; h=From:To:Subject:Date:From; b=oMEbyEGXypYEVry+oxSbfYbzdyrK5gozJu8FMLUERFSdxDdY2u/EhCBIQcl0ON1Tq bf/Ux1qmW+WG30JNszCIOtScaMQpYdVN7FwNVGSzv1o+axsx83Q/Mr5M+kAT7pmxdu LNfSMkLtg3p+7BD/0lJBkZbrWLX1KgaPgXWI15aE= From: "theodort at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110173] New: [14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r14-569-g21e2ef2dc25 Date: Thu, 08 Jun 2023 14:07:02 +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=3D110173 Bug ID: 110173 Summary: [14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r14-569-g21e2ef2dc25 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/ssja5dKdY void foo(void); static int e, f, n, *g, **h =3D &g; static short m; void __assert_fail() __attribute__((__noreturn__)); static short(a)(short b) { return b; } static short(c)(short d) { if (!(((d) >=3D 1) && ((d) <=3D 1))) { __builtin_unreachable(); } return 0; } static int *j(); static void k(int *l, char) { *l =3D 0; if (g =3D=3D &e || g =3D=3D 0 || g =3D=3D &f); else { foo(); __assert_fail(); } c(f < 5); } static void i() { *h =3D j(); } static int *j(unsigned o) { char p; if (g =3D=3D &f || g =3D=3D 0); else __assert_fail(); p =3D m > (a(1) && o); k(&n, p); if (g =3D=3D 0); else __assert_fail(); return 0; } int main() { i(); } gcc-trunk -Os -S:=20 main: movq g(%rip), %rax testq %rax, %rax je .L2 cmpq $f, %rax je .L2 .L3: pushq %rsi xorl %eax, %eax call __assert_fail .L2: xorl %ecx, %ecx movl %ecx, n(%rip) testq %rax, %rax jne .L3 xorl %edx, %edx movq %rdx, g(%rip) ret main: pushq %rsi movq g(%rip), %rax cmpq $f, %rax je .L2 testq %rax, %rax jne .L13 .L2: xorl %ecx, %ecx movl %ecx, n(%rip) cmpq $f, %rax je .L3 testq %rax, %rax je .L11 call foo .L13: xorl %eax, %eax call __assert_fail .L3: testq %rax, %rax jne .L13 .L11: xorl %eax, %eax movq %rax, g(%rip) xorl %eax, %eax popq %rdx ret Bisects to r14-569-g21e2ef2dc25=