public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "iains at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/102528] Unused out-of-line functions emitted for trivial coroutines Date: Tue, 05 Oct 2021 09:24:03 +0000 [thread overview] Message-ID: <bug-102528-4-l8R2hELgBQ@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-102528-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102528 --- Comment #6 from Iain Sandoe <iains at gcc dot gnu.org> --- #include <coroutine> struct simple { struct promise_type { void return_void() {} std::suspend_never initial_suspend() { return {}; } std::suspend_never final_suspend() noexcept { return {}; } void unhandled_exception() { /*throw;*/ } simple get_return_object() { return {}; } }; std::true_type await_ready() {return {}; } void await_suspend(std::coroutine_handle<>) {} void await_resume() {} }; inline simple test1() { co_return; } inline simple test2() { co_await test1(); co_return; } void test() { test1(); } is enough to reproduce at -O2 -std=c++20 -O2 -S -fno-reorder-blocks-and-partition -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables ^^ makes the output a little less complicated. .text .p2align 4 __Z5test1PZ5test1vE15_Z5test1v.Frame.actor: <SNIP> jmp __ZdlPv L3: ud2 .p2align 4 __Z5test1PZ5test1vE15_Z5test1v.Frame.destroy: movzwl 32(%rdi), %eax <SNIP> ret .p2align 4,,10 .p2align 3 L19: jmp __ZdlPv L16: ud2 .p2align 4 .globl __Z4testv __Z4testv: ret L21: nop .ident "GCC: (GNU) 12.0.0 20211003 (experimental)" NOTES: 1/ All traces of test2 are correctly elided (so that it seems we need to have had a use at some earlier point). 2/ at the start of DSE2 we still hold references to the actor and destroyer functions (the ramp has been inlined, and the ramp function elided). 3/ DSE2 elides the coroutine frame and the references to the two functions, but it seems that is too late in the pipeline for them to be removed?
next prev parent reply other threads:[~2021-10-05 9:24 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-09-29 14:47 [Bug c++/102528] New: Unable to inline even " redbeard0531 at gmail dot com 2021-09-29 16:52 ` [Bug c++/102528] Unused out-of-line functions emitted for " redbeard0531 at gmail dot com 2021-10-04 19:23 ` iains at gcc dot gnu.org 2021-10-04 19:31 ` iains at gcc dot gnu.org 2021-10-04 19:41 ` iains at gcc dot gnu.org 2021-10-04 19:55 ` iains at gcc dot gnu.org 2021-10-05 9:24 ` iains at gcc dot gnu.org [this message] 2021-10-05 9:31 ` [Bug ipa/102528] " rguenth at gcc dot gnu.org 2021-10-05 9:46 ` redbeard0531 at gmail dot com 2021-10-05 10:09 ` iains 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-102528-4-l8R2hELgBQ@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).