https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102528
--- Comment #6 from Iain Sandoe <iains at gcc dot gnu.org> --- #include <coroutine> struct simple { struct promise_type { void return_void() {} std::suspend_never initial_suspend() { return {}; } std::suspend_never final_suspend() noexcept { return {}; } void unhandled_exception() { /*throw;*/ } simple get_return_object() { return {}; } }; std::true_type await_ready() {return {}; } void await_suspend(std::coroutine_handle<>) {} void await_resume() {} }; inline simple test1() { co_return; } inline simple test2() { co_await test1(); co_return; } void test() { test1(); } is enough to reproduce at -O2 -std=c++20 -O2 -S -fno-reorder-blocks-and-partition -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables ^^ makes the output a little less complicated. .text .p2align 4 __Z5test1PZ5test1vE15_Z5test1v.Frame.actor: <SNIP> jmp __ZdlPv L3: ud2 .p2align 4 __Z5test1PZ5test1vE15_Z5test1v.Frame.destroy: movzwl 32(%rdi), %eax <SNIP> ret .p2align 4,,10 .p2align 3 L19: jmp __ZdlPv L16: ud2 .p2align 4 .globl __Z4testv __Z4testv: ret L21: nop .ident "GCC: (GNU) 12.0.0 20211003 (experimental)" NOTES: 1/ All traces of test2 are correctly elided (so that it seems we need to have had a use at some earlier point). 2/ at the start of DSE2 we still hold references to the actor and destroyer functions (the ramp has been inlined, and the ramp function elided). 3/ DSE2 elides the coroutine frame and the references to the two functions, but it seems that is too late in the pipeline for them to be removed?