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

Weibo He via cfe-commits cfe-commits at lists.llvm.org
Mon May 19 17:09:28 PDT 2025


================
@@ -1343,6 +1343,11 @@ llvm::Value *CodeGenFunction::EmitLifetimeStart(llvm::TypeSize Size,
   if (!ShouldEmitLifetimeMarkers)
     return nullptr;
 
+  // No lifetimes on promise alloca, or middle end passes will assume promise
+  // dead after lifetime.end, leading to mis-optimization
+  if (Addr->getName() == "__promise")
----------------
NewSigma wrote:

Thank you for catching that. I've now used VarDecl::getName and tested it on non-assert builds.

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


More information about the cfe-commits mailing list