While looking through diffs between the Swift branch and llvm.org if found the following patch that I previously forgot to upstream. The patch also calls coro::salavageDebugInf()o on all dbg.declares in entry function. This is necessary for Swift because in the Swift calling convention the entry function can already have a coroutine context argument. I believe that the patch is neutral for C++ coroutines at -O0 (and mildly beneficial at -O), as it does rewrite dbg.declares to point into the freshly setup coroutine frame, as shown in the updated test.
Diff Detail
Diff Detail