diff options
author | Petr Hosek <phosek@chromium.org> | 2019-07-24 00:16:23 +0000 |
---|---|---|
committer | Petr Hosek <phosek@chromium.org> | 2019-07-24 00:16:23 +0000 |
commit | 8b161bacf413d2e4f133b3dea121f1d7ae9301b7 (patch) | |
tree | 47e1b91029026daaa5d92147cda3c90ce2548f10 /llvm/lib/Transforms/Utils/Local.cpp | |
parent | 4287c95b08ab9b10cce50ab8139f536ea2d72f1d (diff) | |
download | llvm-8b161bacf413d2e4f133b3dea121f1d7ae9301b7.zip llvm-8b161bacf413d2e4f133b3dea121f1d7ae9301b7.tar.gz llvm-8b161bacf413d2e4f133b3dea121f1d7ae9301b7.tar.bz2 |
[SafeStack] Insert the deref before remaining elements
This is a follow up to D64971. While we need to insert the deref after
the offset, it needs to come before the remaining elements in the
original expression since the deref needs to happen before the LLVM
fragment if present.
Differential Revision: https://reviews.llvm.org/D65172
llvm-svn: 366865
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index b6d555c..8e50172 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -1599,13 +1599,8 @@ static void replaceOneDbgValueForAlloca(DbgValueInst *DVI, Value *NewAddress, // Insert the offset before the first deref. // We could just change the offset argument of dbg.value, but it's unsigned... - if (Offset) { - SmallVector<uint64_t, 4> Ops; - DIExpression::appendOffset(Ops, Offset); - Ops.append(DIExpr->elements_begin() + 1, DIExpr->elements_end()); - Ops.push_back(dwarf::DW_OP_deref); - DIExpr = Builder.createExpression(Ops); - } + if (Offset) + DIExpr = DIExpression::prepend(DIExpr, 0, Offset); Builder.insertDbgValueIntrinsic(NewAddress, DIVar, DIExpr, Loc, DVI); DVI->eraseFromParent(); |