[clang] [Clang][CodeGen] Do not emit lifetime intrinsics for coro promise alloca (PR #140548)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Mon May 19 19:52:57 PDT 2025


================
@@ -1599,9 +1599,14 @@ CodeGenFunction::EmitAutoVarAlloca(const VarDecl &D) {
       bool IsMSCatchParam =
           D.isExceptionVariable() && getTarget().getCXXABI().isMicrosoft();
 
+      // No lifetime intrinsics on coroutine promise alloca, or middle end
+      // passes will assume promise dead after lifetime.end, leading to
+      // mis-optimization
+      bool IsCoroPromise = D.getName() == "__promise";
----------------
ChuanqiXu9 wrote:

We should avoid comparing string as much as possible. And also it is not good to insert coroutines logic to `CGDecl.cpp`. We'd either doing this in CGCoroutine or CoroEarly.

https://github.com/llvm/llvm-project/pull/140548


More information about the cfe-commits mailing list