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

2025-05-20 Thread Weibo He via cfe-commits
NewSigma wrote: After further consideration, I think this is not a satisfactory solution to the issue. I may revisit it if I develop a concrete plan. Apologies for any inconvenience. https://github.com/llvm/llvm-project/pull/140548 ___ cfe-commits ma

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

2025-05-20 Thread Weibo He via cfe-commits
https://github.com/NewSigma closed https://github.com/llvm/llvm-project/pull/140548 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-05-19 Thread Weibo He via cfe-commits
@@ -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-optim

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

2025-05-19 Thread Weibo He via cfe-commits
https://github.com/NewSigma updated https://github.com/llvm/llvm-project/pull/140548 >From d2e1a8d8a650f2a38387c500f942a0c6722c8a84 Mon Sep 17 00:00:00 2001 From: NewSigma Date: Mon, 19 May 2025 22:12:45 +0800 Subject: [PATCH 1/2] Do not emit lifetime intrinsics for coro promise alloca --- cl

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

2025-05-19 Thread Weibo He via cfe-commits
NewSigma wrote: Here is a example ``` LLVM define i32 @fn() { entry: %__promise = alloca i32, align 4 %id = call token @llvm.coro.id(i32 16, ptr nonnull %__promise, ptr nonnull @fn, ptr null) %hdl = call ptr @llvm.coro.begin(token %id, ptr null) #14 %promise.addr = call ptr @llvm.coro.p

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

2025-05-19 Thread Weibo He via cfe-commits
https://github.com/NewSigma created https://github.com/llvm/llvm-project/pull/140548 Coro promise has same lifetime as coro frame. It do not need explicit lifetime guarding. If we add lifetimes to it, middle end passes may assume promise dead after lifetime.end, leading to mis-optimizations.