public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redbeard0531 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/102528] New: Unable to inline even trivial coroutines
Date: Wed, 29 Sep 2021 14:47:27 +0000	[thread overview]
Message-ID: <bug-102528-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102528

            Bug ID: 102528
           Summary: Unable to inline even trivial coroutines
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redbeard0531 at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/aoab9W4xG

This should all compile away, and test() should just be a single ret
instruction. That is not what happens now, even with -O3.

#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() {
    test2();
}

             reply	other threads:[~2021-09-29 14:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-29 14:47 redbeard0531 at gmail dot com [this message]
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 ` [Bug ipa/102528] " iains at gcc dot gnu.org
2021-10-05  9:31 ` 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@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: link
Be 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).