Skip to content

[Coroutines] Support @llvm.coro.await_suspend actually  #64945

Closed
@ChuanqiXu9

Description

@ChuanqiXu9

After c467245, we will add a noinline attribute to the await_suspend member function of an awaiter if the awaiter has any non static member functions.

Obviously, this decision will bring some performance regressions. e.g., #64933

The suggested long term solution is to introduce the new intrinisic:

call @llvm.coro.await_suspend(ptr %awaiter, ptr %handle,
                                                      ptr @awaitSuspendFn)

Then in the middle end, we can perform analysis the awaitSuspendFn to see if the coroutine handle escapes or not. If it won't escape, we can replace above intrinsic to the direct call. Otherwise, we will only convert them in the CoroSplit phase.

The key point of the solution is that it is much easier and better to do analysis in the middle end instead of the frontend.

Metadata

Metadata

Assignees

Labels

clang:codegenIR generation bugs: mangling, exceptions, etc.clang:frontendLanguage frontend issues, e.g. anything involving "Sema"coroutinesC++20 coroutinesmissed-optimization

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions