Move dbg.declare intrinsics when merging and replacing allocas.
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Tue, 29 Sep 2015 00:30:19 +0000 (00:30 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Tue, 29 Sep 2015 00:30:19 +0000 (00:30 +0000)
commite0bc463811467769db02def8163beb9bf90faf6f
treeeae5d358845b4321e627f449e63b28b958b4376e
parent64ffcd4e983e4159bcb39104e77f2eb2a15473b7
Move dbg.declare intrinsics when merging and replacing allocas.

Place new and update dbg.declare calls immediately after the
corresponding alloca.

Current code in replaceDbgDeclareForAlloca puts the new dbg.declare
at the end of the basic block. LLVM codegen has problems emitting
debug info in a situation when dbg.declare appears after all uses of
the variable. This usually kinda works for inlining and ASan (two
users of this function) but not for SafeStack (see the pending change
in http://reviews.llvm.org/D13178).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248769 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/IPO/Inliner.cpp
lib/Transforms/Utils/Local.cpp
test/Transforms/Inline/alloca-dbgdeclare-merge.ll [new file with mode: 0644]
test/Transforms/Inline/inline_dbg_declare.ll