diff options
author | Frederic Riss <friss@apple.com> | 2014-12-09 17:55:48 +0000 |
---|---|---|
committer | Frederic Riss <friss@apple.com> | 2014-12-09 17:55:48 +0000 |
commit | 7c78db5065a34dd91b294fc68ad1b1ea0df13cba (patch) | |
tree | 0bcc804b94df2187058559167ba232df9ca2c7bb /llvm/lib | |
parent | 3a4095de83f34df1f283af5af7abd200c8655c1c (diff) | |
download | bcm5719-llvm-7c78db5065a34dd91b294fc68ad1b1ea0df13cba.tar.gz bcm5719-llvm-7c78db5065a34dd91b294fc68ad1b1ea0df13cba.zip |
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.
llvm-svn: 223799
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index c963c51ec63..f8f62a9273d 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -1111,7 +1111,7 @@ bool llvm::replaceDbgDeclareForAlloca(AllocaInst *AI, Value *NewAllocaAddress, if (!DIVar) return false; - // Create a copy of the original DIDescriptor for user variable, appending + // Create a copy of the original DIDescriptor for user variable, prepending // "deref" operation to a list of address elements, as new llvm.dbg.declare // will take a value storing address of the memory for variable, not // alloca itself. @@ -1121,7 +1121,7 @@ bool llvm::replaceDbgDeclareForAlloca(AllocaInst *AI, Value *NewAllocaAddress, NewDIExpr.push_back(DIExpr.getElement(i)); } } - NewDIExpr.push_back(dwarf::DW_OP_deref); + NewDIExpr.insert(NewDIExpr.begin(), dwarf::DW_OP_deref); // Insert llvm.dbg.declare in the same basic block as the original alloca, // and remove old llvm.dbg.declare. |