ChuanqiXu9 wrote:

Thanks for the patch. I like it in the very high level. I did a quick scanning 
over the PR  and here is some comments:

- I feel the name containing `concurrency` is not proper. I don't feel it 
relates concurrency in any level.
- Every time we add or change IR related to coroutines, we need to update 
https://llvm.org/docs/Coroutines.html. So that we can understand the semantics 
of the proposed `llvm.coro.safe.elide` much easier.
- I'd like to add a new effect to the attribute to always inline (or an inline 
hint) every such callee function. Note that this won't be part of semantics but 
the implementation details.

For implementations,

- It looks like the argument of `llvm.coro.safe.elide` is the object. This is 
not good. The object is the concept in the higher level language but not the 
middle end language.
- What I prefer is to add a middle end function attribute (`must-coro-elide`) 
and apply this attribute and (always inline attribute) to the calls:
    - In the inliner, when we inlined a call with attribute `must-coro-elide`, 
we can add the attribute again to inlined intrinsics `llvm.coro.id`.
    - Then in the coro elider, we can decide whether or not to elide the 
specific corotuines by judging if the `llvm.coro.id` has the attribute very 
easily.

For FE implementation,
- To implement the semantics precisely, I think we have to touch the Parser and 
the Sema.  Otherwise, it may be pretty tricky to handle cases like `co_await 
foo(bar(...))` or `co_await (foo() + bar());`. It is hacky to implement this in 
CodeGen.

https://github.com/llvm/llvm-project/pull/94693
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to