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

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Mon May 4 06:16:21 PDT 2026


zmodem wrote:

> 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.

Yes, mem2reg will drop it; see the change to llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp and the test in llvm/test/Transforms/Mem2Reg/ignore-coro-outside-frame.ll

But, I think https://github.com/llvm/llvm-project/pull/194690#issuecomment-4344922589 shows that this is a problem: if we promote the alloca to a register, we may spill that to the coroutine frame.

So maybe what we want is to *block* optimizations from promoting an alloca when this intrinsic is used, to make sure it stays out of the coroutine frame. I checked that this would have prevented the bug in #192351.

The intrinsic will be removed after CoroSplit, so at that point the optimizations can treat the alloca as any other.

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


More information about the cfe-commits mailing list