[PATCH] D98638: [RFC][Coroutine] Force stack allocation after await_suspend() call
JunMa via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 17 23:38:56 PDT 2021
junparser added a comment.
In D98638#2630786 <https://reviews.llvm.org/D98638#2630786>, @lxfind wrote:
> Well, I guess another potential solution is to force emitting lifetime intrinsics for this part of coroutine in the front-end.
> Like this:
>
> diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
> index 243d93a8c165..ef76e8dcb7c9 100644
> --- a/clang/lib/CodeGen/CGDecl.cpp
> +++ b/clang/lib/CodeGen/CGDecl.cpp
> @@ -1317,7 +1317,7 @@ void CodeGenFunction::EmitAutoVarDecl(const VarDecl &D) {
> /// otherwise
> llvm::Value *CodeGenFunction::EmitLifetimeStart(uint64_t Size,
> llvm::Value *Addr) {
> - if (!ShouldEmitLifetimeMarkers)
> + if (!ShouldEmitLifetimeMarkers && !isCoroutine())
> return nullptr;
>
> assert(Addr->getType()->getPointerAddressSpace() ==
> diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
> index 18f1468dcb86..2e6e6808db7f 100644
> --- a/clang/lib/CodeGen/CGExpr.cpp
> +++ b/clang/lib/CodeGen/CGExpr.cpp
> @@ -535,7 +535,7 @@ EmitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *M) {
> break;
>
> case SD_FullExpression: {
> - if (!ShouldEmitLifetimeMarkers)
> + if (!ShouldEmitLifetimeMarkers && !isCoroutine())
> break;
>
> // Avoid creating a conditional cleanup just to hold an llvm.lifetime.end
We have already allowed to emit lifetime intrinsics for always inlined function under O2 <https://reviews.llvm.org/owners/package/2/>, so IMOO emitting lifetime intrinsics for coroutine function is OK since stack coloring has less effect on coroutine function.
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