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

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Mon May 19 12:53:10 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")
----------------
efriedma-quic wrote:

You can't use getName() like this: the name gets discarded in non-asserts builds.

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


More information about the cfe-commits mailing list