From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0A6873856DF1; Wed, 17 May 2023 15:15:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0A6873856DF1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684336559; bh=WpjAJpfnW6oV701JHbSvOLzVc50fO2wUg+7TjifY0sQ=; h=From:To:Subject:Date:From; b=SxOjsrOM5A3mv67lPoxtSVZnx9VhR9Rd6Vqe4zVQivJ7mCUel1WsuZ9R9K0VIiuLT f0V7HeCkhlt3MEcDJSCm2FI/Y05ZWx5q0YEaKrcihbSgJ9A31WYkUYyFF0Q1B22ycM 7h7KHEVqxrcnIBCcqJEktOE1k53/rP17HtVH0Drc= From: "theodort at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109893] New: [14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r14-160-gf828503eeb79ad1f1ada6db7deccc5abcc2f3ca3 Date: Wed, 17 May 2023 15:15:58 +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=3D109893 Bug ID: 109893 Summary: [14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r14-160-gf828503eeb79ad1f1ada6db7deccc5abcc2f3ca3 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: --- void foo(void); void bar(void); static char a; static int b, e, f; static int *c =3D &b, *g; int main() { int *j =3D 0; if (a) { g =3D 0; if (c) bar(); } else { j =3D &e; c =3D 0; } if (c =3D=3D &f =3D=3D b || c =3D=3D &e) ; else __builtin_unreachable(); if (g || e) { if (j =3D=3D &e || j =3D=3D 0) ; else foo(); } a =3D 4; } gcc -O3:=20 main: cmpb $0, a(%rip) je .L2 xorl %esi, %esi cmpq $0, c(%rip) movq %rsi, g(%rip) je .L7 pushq %rdx call bar movb $4, a(%rip) xorl %eax, %eax popq %rcx ret .L2: xorl %eax, %eax movq %rax, c(%rip) .L7: movb $4, a(%rip) xorl %eax, %eax ret c: .quad b gcc-trunk -O3=20 main: subq $8, %rsp cmpb $0, a(%rip) je .L2 xorl %edx, %edx cmpq $0, c(%rip) movq %rdx, g(%rip) je .L6 call bar xorl %eax, %eax .L4: cmpq $0, g(%rip) je .L9 .L6: movb $4, a(%rip) xorl %eax, %eax addq $8, %rsp ret .L2: xorl %eax, %eax movq %rax, c(%rip) movl $e, %eax jmp .L4 .L9: cmpl $0, e(%rip) je .L6 testq %rax, %rax je .L6 cmpq $e, %rax je .L6 call foo jmp .L6 c: .quad b Bisects to: https://gcc.gnu.org/git/gitweb.cgi?p=3Dgcc.git;h=3Df828503eeb79ad1f1ada6db7= deccc5abcc2f3ca3=