Correctly handle complex locations expressions in replaceDbgDeclareForAlloca()
authorFrederic Riss <friss@apple.com>
Tue, 9 Dec 2014 17:55:48 +0000 (17:55 +0000)
committerFrederic Riss <friss@apple.com>
Tue, 9 Dec 2014 17:55:48 +0000 (17:55 +0000)
commitfa3c6dea6a698089489219a056f79313b3ecff52
tree9dc559d70ed954ada017c2aa1cb7890f9e31224b
parent1be6bc79f6e8f47dda0aa13a62e0634aead588dc
Correctly handle complex locations expressions in replaceDbgDeclareForAlloca()

replaceDbgDeclareForAlloca() replaces an alloca by a value storing the
address of what was the alloca. If there is a dbg.declare corresponding
to that alloca, we need to lower it to a dbg.value describing the additional
dereference operation to be performed to get to the underlying variable.
 This is done by adding a DW_OP_deref to the complex location part of the
location description. This deref was added to the end of the operation list,
which is wrong. The expression applies to what is described by the
dbg.{declare,value}, and as we are changing this, we need to apply the
DW_OP_deref as the first operation in the list.

Part of the fix for rdar://19162268.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223799 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/Local.cpp
test/DebugInfo/block-asan.ll [new file with mode: 0644]