public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "nok.raven at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/108992] New: Regression: Branch direction canonicalization leads to pointless tail duplication / CSE/sinking by inverting branch Date: Thu, 02 Mar 2023 17:12:50 +0000 [thread overview] Message-ID: <bug-108992-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108992 Bug ID: 108992 Summary: Regression: Branch direction canonicalization leads to pointless tail duplication / CSE/sinking by inverting branch Product: gcc Version: 6.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: nok.raven at gmail dot com Target Milestone: --- There are two regressions, in GCC 7 and in GCC 8. If you invert branch manually (replace 'cond' with '!cond') - the results were the same previously. // Regressed since GCC 7: https://godbolt.org/z/h4brz7zG9 void use(int *); void use2(int *); void foo(bool cond, int * p) { if (cond) { use(p); } use2(p); } // GCC 6 foo(bool, int*): test dil, dil push rbx mov rbx, rsi je .L2 mov rdi, rsi call use(int*) .L2: mov rdi, rbx pop rbx jmp use2(int*) // GCC 7 foo(bool, int*): test dil, dil jne .L8 mov rdi, rsi jmp use2(int*) .L8: sub rsp, 24 mov rdi, rsi mov QWORD PTR [rsp+8], rsi call use2(int*) mov rsi, QWORD PTR [rsp+8] add rsp, 24 mov rdi, rsi jmp use2(int*) // Regressed since GCC 8: https://godbolt.org/z/MjxqTnbKa void use(int *); void use2(int *); void foo(int * p, bool cond) { if (cond) { use(p); } use2(p); } // GCC 7 foo(int*, bool): test sil, sil push rbx mov rbx, rdi je .L2 call use(int*) .L2: mov rdi, rbx pop rbx jmp use2(int*) // GCC 8 foo(int*, bool): push rbx mov rbx, rdi test sil, sil jne .L5 mov rdi, rbx pop rbx jmp use2(int*) .L5: call use(int*) mov rdi, rbx pop rbx jmp use2(int*)
next reply other threads:[~2023-03-02 17:12 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-03-02 17:12 nok.raven at gmail dot com [this message] 2023-03-02 19:23 ` [Bug rtl-optimization/108992] " pinskia at gcc dot gnu.org 2023-03-02 19:48 ` nok.raven at gmail dot com 2023-03-02 22:37 ` pinskia at gcc dot gnu.org 2023-03-02 22:46 ` [Bug middle-end/108992] " pinskia at gcc dot gnu.org 2023-03-02 22:54 ` pinskia at gcc dot gnu.org 2023-03-02 23:24 ` nok.raven at gmail dot com 2023-03-02 23:35 ` pinskia at gcc dot gnu.org 2023-03-02 23:39 ` pinskia 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-108992-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).