[PATCH] D98638: [RFC][Coroutine] Force stack allocation after await_suspend() call

Xun Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 16 23:09:22 PDT 2021


lxfind added inline comments.


================
Comment at: clang/lib/CodeGen/CGCoroutine.cpp:221
     CGF.EmitBlock(RealSuspendBlock);
+  } else if (ForcestackStart) {
+    Builder.CreateCall(
----------------
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.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98638/new/

https://reviews.llvm.org/D98638



More information about the llvm-commits mailing list