[PATCH] D99227: [Coroutine][Clang] Force emit lifetime intrinsics for Coroutines

Xun Li via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 23 22:58:42 PDT 2021


lxfind added inline comments.


================
Comment at: clang/lib/CodeGen/CGDecl.cpp:1318
 /// otherwise
 llvm::Value *CodeGenFunction::EmitLifetimeStart(uint64_t Size,
                                                 llvm::Value *Addr) {
----------------
ChuanqiXu wrote:
> Can we sure frontend would always call this API to emit lifetime start? I mean the frontend may call EmitIntrinsic or create lifetime.start intrinsic directly whether by IRBuilder::CreateXXX or Instrinsic::Create(...). I worry about if this would incur changes out of design.
> 
> Then if we add check in EmitLifetimeStart, why not we add check in EmitLfietimeEnd?
I searched in the codebase, and we always call this API to emit lifetime start in the front-end.
Also, for coroutine to behave correctly, we really only need SD_FullExpression to be able to emit it. Other cases are less critical.

Usually when it emits a LifetimeStart instruction, it will store it somewhere, and latter check on it to decide whether it needs to emit a lifetime end. That's when there is no checks needed for lifetime end.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99227



More information about the cfe-commits mailing list