[clang] [llvm] [Coroutines] Replace coro.outside.frame metadata with an intrinsic (PR #129255)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 30 00:55:30 PDT 2026


ChuanqiXu9 wrote:

> [#194690 (comment)](https://github.com/llvm/llvm-project/pull/194690#issuecomment-4344922589) seems to mention a case where an optimization dropping this metadata leads to miscompilation:
> 
> > !coro.outside.frame is applied to `%b.addr`; this metadata is dropped when SROA removes the alloca and replaces it with direct uses of `%b`. `%b` is spilled into the coroutine frame later during CoroSplit.
> 
> > I am still concerning about the potential performance loss on using the intrinsic on parameters. Did you have any insight?
> 
> I guess I should find some benchmarks :) But I am concerned that we're relying on this metadata for correctness. 

If an alloca is used by the new intrinsic, can optimization pass optimize the alloca out and also the new intrinsic? If yes, I feel good. But if no, it may not be too good...

> It's a long term LLVM contract that dropping metadata should not change the validity of IR.

yeah, I didn't know this when we made the decision... 

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


More information about the cfe-commits mailing list