[Coroutines] Handle InvokeInst in SalvageDebugInfo
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>
Fri, 3 Dec 2021 05:46:52 +0000 (13:46 +0800)
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>
Fri, 3 Dec 2021 05:46:54 +0000 (13:46 +0800)
commit84980761a777619291e4877014c5f00ca512e4b8
tree8e8bbcf03f1bdf204cdb5a9d8daaab27545db370
parent7bb785cc339b0ea268e388c570c9a0cd78f136c8
[Coroutines] Handle InvokeInst in SalvageDebugInfo

Since coroutine would be splitted into pieces, compiler would move the
dbg.declare intrinsic after the Storage is created to make sure the
corresponding dbg instruction is still available aftet splitted.
However, it would be problematic if the storage instruction is an
InvokeInst, which is a terminator. We couldn't move instruction after an
InvokeInst. This patch tries to move the dbg.declare intrinsic in the
normal destination of the InvokeInst. It should make sense due to the
Storage should be invalid in exception path.
llvm/lib/Transforms/Coroutines/CoroFrame.cpp
llvm/test/Transforms/Coroutines/coro-debug.ll