diff options
| author | Markus Lavin <markus.lavin@ericsson.com> | 2019-05-06 07:20:56 +0000 |
|---|---|---|
| committer | Markus Lavin <markus.lavin@ericsson.com> | 2019-05-06 07:20:56 +0000 |
| commit | a778074165ca9554c9556b9bbeee6ca4e2babe96 (patch) | |
| tree | 78fe69b0eb3de4ecb14905f1652c7281a90ab12f /llvm/lib/Transforms/IPO | |
| parent | 4732d3abdf078f4a1381edb2acb2a2b73e2636b9 (diff) | |
| download | bcm5719-llvm-a778074165ca9554c9556b9bbeee6ca4e2babe96.tar.gz bcm5719-llvm-a778074165ca9554c9556b9bbeee6ca4e2babe96.zip | |
[DebugInfo] GlobalOpt DW_OP_deref_size instead of DW_OP_deref.
Optimization pass lib/Transforms/IPO/GlobalOpt.cpp needs to insert
DW_OP_deref_size instead of DW_OP_deref to be compatible with big-endian
targets for same reasons as in D59687.
Differential Revision: https://reviews.llvm.org/D60611
llvm-svn: 360013
Diffstat (limited to 'llvm/lib/Transforms/IPO')
| -rw-r--r-- | llvm/lib/Transforms/IPO/GlobalOpt.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp index 4d2b0178612..2a869444d6e 100644 --- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp +++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp @@ -1654,6 +1654,9 @@ static bool TryToShrinkGlobalToBoolean(GlobalVariable *GV, Constant *OtherVal) { for(auto *GVe : GVs){ DIGlobalVariable *DGV = GVe->getVariable(); DIExpression *E = GVe->getExpression(); + const DataLayout &DL = GV->getParent()->getDataLayout(); + unsigned SizeInOctets = + DL.getTypeAllocSizeInBits(NewGV->getType()->getElementType()) / 8; // It is expected that the address of global optimized variable is on // top of the stack. After optimization, value of that variable will @@ -1664,8 +1667,9 @@ static bool TryToShrinkGlobalToBoolean(GlobalVariable *GV, Constant *OtherVal) { // DW_OP_deref DW_OP_constu <ValMinus> // DW_OP_mul DW_OP_constu <ValInit> DW_OP_plus DW_OP_stack_value SmallVector<uint64_t, 12> Ops = { - dwarf::DW_OP_deref, dwarf::DW_OP_constu, ValMinus, - dwarf::DW_OP_mul, dwarf::DW_OP_constu, ValInit, + dwarf::DW_OP_deref_size, SizeInOctets, + dwarf::DW_OP_constu, ValMinus, + dwarf::DW_OP_mul, dwarf::DW_OP_constu, ValInit, dwarf::DW_OP_plus}; E = DIExpression::prependOpcodes(E, Ops, DIExpression::WithStackValue); DIGlobalVariableExpression *DGVE = |

