public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "theodort at inf dot ethz.ch" <gcc-bugzilla@gcc.gnu.org> 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 [thread overview] Message-ID: <bug-109893-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109893 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 = &b, *g; int main() { int *j = 0; if (a) { g = 0; if (c) bar(); } else { j = &e; c = 0; } if (c == &f == b || c == &e) ; else __builtin_unreachable(); if (g || e) { if (j == &e || j == 0) ; else foo(); } a = 4; } gcc -O3: 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 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=gcc.git;h=f828503eeb79ad1f1ada6db7deccc5abcc2f3ca3
next reply other threads:[~2023-05-17 15:15 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-05-17 15:15 theodort at inf dot ethz.ch [this message] 2023-05-17 15:29 ` [Bug tree-optimization/109893] " pinskia at gcc dot gnu.org 2023-08-09 6:33 ` pinskia at gcc dot gnu.org 2024-01-12 12:53 ` rguenth at gcc dot gnu.org 2024-03-08 15:36 ` law at gcc dot gnu.org 2024-05-07 7:40 ` [Bug tree-optimization/109893] [14/15 " rguenth at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-109893-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).