[PATCH] D98638: [RFC][Coroutine] Force stack allocation after await_suspend() call
Chuanqi Xu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 16 23:17:34 PDT 2021
ChuanqiXu added inline comments.
================
Comment at: clang/lib/CodeGen/CGCoroutine.cpp:221
CGF.EmitBlock(RealSuspendBlock);
+ } else if (ForcestackStart) {
+ Builder.CreateCall(
----------------
lxfind wrote:
> ChuanqiXu wrote:
> > ChuanqiXu wrote:
> > > can we rewrite it into:
> > > ```
> > > else if (SuspendRet != nullptr && SuspendRet->getType()->isClassType()) {
> > > // generate:
> > > // llvm.coro.forcestack(SuspendRet)
> > > }
> > > ```
> > Sorry I find we can't did it directly. As you said, we need to traverse down SuspendRet. And I still think we should did it only at CodeGen part since it looks not so hard. I guess we could make it in above 10~15 lines of codes.
> Traversing down AST isn't the hard part. The hard part is to search the emitted IR, and look for the temporary alloca used to store the returned handle.
Yes, I get your point. If we want to traverse the emitted IR, we could only search for the use-chain backward, which is also very odd. Let's see if there is other ways to modify the ASTNodes to make it more naturally.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D98638/new/
https://reviews.llvm.org/D98638
More information about the cfe-commits
mailing list