[llvm] coro: Do not capture pointer locals that have no provenance (PR #223321)

Chuanqi Xu via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 27 20:50:43 PDT 2026


ChuanqiXu9 wrote:

> @ChuanqiXu9 I see. So for some reason lifetime markers are not used for `retcon` entirely, and so is this code rather limited to `retcon` but not the usual C++ `co_await` coro.
> 
> A small observation I am having here. If `capture(address)` eventually leads to capture of the alloca into the detached frame so that we observe stability in the address bytes, I am afraid that this behaviour is already diverging from what Rust believes. Rust does not believe that uncaptured locals in coroutines necessarily get assigned a stable address. I am glad to see that lifetime markers are actually used for analysis to decide the escaping. It was a bit unfortunate that Rust could not use that lowering directly.

I didn't know Rust uses LLVM coroutines. I thought the only users of `retcon` were swift. 

>  Rust does not believe that uncaptured locals in coroutines necessarily get assigned a stable address. 

Maybe I had problem reading this. What is uncaptured locals? Do you mean local variables not on the frame? Then their address is not stable in C++ too.

The logic here may be, if the address matters, they need to be on the frame, in C++.

> 
> cc @jyknight



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


More information about the llvm-commits mailing list