public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug middle-end/95014] New: gcc fails to merge two identical returns @ 2020-05-08 18:40 rafael at espindo dot la 2021-04-30 17:58 ` [Bug middle-end/95014] " vanyacpp at gmail dot com ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: rafael at espindo dot la @ 2020-05-08 18:40 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95014 Bug ID: 95014 Summary: gcc fails to merge two identical returns Product: gcc Version: 10.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: rafael at espindo dot la Target Milestone: --- Given #include <new> union any { any(any&& x) noexcept { if (x.st < 4) { st = x.st; x.st = 0; } else { ex = x.ex; x.ex = nullptr; } } long st; void* ex; }; void f(any* a, any* b) { new (a) any(std::move(*b)); } gcc produces movq (%rsi), %rax movq %rax, (%rdi) movq $0, (%rsi) cmpq $3, %rax jg .L2 ret .L2: ret clang produces movq (%rsi), %rax cmpq $3, %rax movq %rax, (%rdi) movq $0, (%rsi) retq So clang has a redundant cmpq and gcc has the cmpq and two identical branch destinations. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/95014] gcc fails to merge two identical returns 2020-05-08 18:40 [Bug middle-end/95014] New: gcc fails to merge two identical returns rafael at espindo dot la @ 2021-04-30 17:58 ` vanyacpp at gmail dot com 2021-08-01 18:28 ` pinskia at gcc dot gnu.org 2023-08-08 6:23 ` pinskia at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: vanyacpp at gmail dot com @ 2021-04-30 17:58 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95014 Ivan Sorokin <vanyacpp at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |vanyacpp at gmail dot com --- Comment #1 from Ivan Sorokin <vanyacpp at gmail dot com> --- I think this might be a duplicate of 82689. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/95014] gcc fails to merge two identical returns 2020-05-08 18:40 [Bug middle-end/95014] New: gcc fails to merge two identical returns rafael at espindo dot la 2021-04-30 17:58 ` [Bug middle-end/95014] " vanyacpp at gmail dot com @ 2021-08-01 18:28 ` pinskia at gcc dot gnu.org 2023-08-08 6:23 ` pinskia at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: pinskia at gcc dot gnu.org @ 2021-08-01 18:28 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95014 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2021-08-01 Severity|normal |enhancement --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed. Note I have not looked into why but on aarch64-linux-gnu GCC can remove the cmp/jump. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/95014] gcc fails to merge two identical returns 2020-05-08 18:40 [Bug middle-end/95014] New: gcc fails to merge two identical returns rafael at espindo dot la 2021-04-30 17:58 ` [Bug middle-end/95014] " vanyacpp at gmail dot com 2021-08-01 18:28 ` pinskia at gcc dot gnu.org @ 2023-08-08 6:23 ` pinskia at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: pinskia at gcc dot gnu.org @ 2023-08-08 6:23 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95014 --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Note cross jumping on the RTL level is what is able to combine both basic blocks. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-08-08 6:23 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-05-08 18:40 [Bug middle-end/95014] New: gcc fails to merge two identical returns rafael at espindo dot la 2021-04-30 17:58 ` [Bug middle-end/95014] " vanyacpp at gmail dot com 2021-08-01 18:28 ` pinskia at gcc dot gnu.org 2023-08-08 6:23 ` pinskia at gcc dot gnu.org
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).