Skip to content

clang optimization issue in coroutines(not allocations) #64933

@kelbon

Description

@kelbon
Contributor

https://godbolt.org/z/5hTE69j1b

starting row 82 in asm there are something strange in 'trunk', im 99% sure someone apply 'cold' attribute or 'never inline' to all functions in final suspend or smth like.

All calls must be inlined, its literaly one-row functions.

g1() [clone .resume]:                          # @g1() [clone .resume]
        push    rbx
        sub     rsp, 16
        cmp     byte ptr [rdi + 44], 0
        je      .LBB8_1
        lea     rbx, [rdi + 16]
        mov     qword ptr [rdi], 0
        call    std::__n4861::coroutine_handle<dd::generator_promise<int> >::from_address(void*)
        mov     qword ptr [rsp + 8], rax
        lea     rdi, [rsp + 8]
        call    std::__n4861::coroutine_handle<dd::generator_promise<int> >::operator std::__n4861::coroutine_handle<void>() const
        mov     rdi, rbx
        mov     rsi, rax
        call    dd::generator_promise<int>::await_suspend(std::__n4861::coroutine_handle<void>) const
        mov     qword ptr [rsp], rax
        mov     rdi, rsp
        call    std::__n4861::coroutine_handle<void>::address() const
        mov     rdi, rax
        add     rsp, 16
        pop     rbx
        jmp     qword ptr [rax]                 # TAILCALL
.LBB8_1:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @EugeneZelenko@kelbon@llvmbot@ChuanqiXu9

        Issue actions

          clang optimization issue in coroutines(not allocations) · Issue #64933 · llvm/llvm-project