[PATCH] D60611: [DebugInfo] GlobalOpt DW_OP_deref_size instead of DW_OP_deref.

Markus Lavin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 6 00:19:06 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL360013: [DebugInfo] GlobalOpt DW_OP_deref_size instead of DW_OP_deref. (authored by markus, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D60611?vs=194852&id=198226#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60611/new/

https://reviews.llvm.org/D60611

Files:
  llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
  llvm/trunk/test/Transforms/GlobalOpt/integer-bool-dwarf.ll


Index: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
===================================================================
--- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
+++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
@@ -1654,6 +1654,9 @@
       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 @@
         // 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 =
Index: llvm/trunk/test/Transforms/GlobalOpt/integer-bool-dwarf.ll
===================================================================
--- llvm/trunk/test/Transforms/GlobalOpt/integer-bool-dwarf.ll
+++ llvm/trunk/test/Transforms/GlobalOpt/integer-bool-dwarf.ll
@@ -2,7 +2,7 @@
 
 ;CHECK: @foo = internal unnamed_addr global i1 false, align 4, !dbg ![[VAR:.*]]
 ;CHECK: ![[VAR]] = !DIGlobalVariableExpression(var: !1, expr:
-;CHECK-SAME: !DIExpression(DW_OP_deref, DW_OP_constu, 111, DW_OP_mul,
+;CHECK-SAME: !DIExpression(DW_OP_deref_size, 1, DW_OP_constu, 111, DW_OP_mul,
 ;CHECK-SAME:               DW_OP_constu, 0, DW_OP_plus, DW_OP_stack_value,
 ;CHECK-SAME:               DW_OP_LLVM_fragment, 0, 1)) 
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60611.198226.patch
Type: text/x-patch
Size: 2040 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190506/20e81638/attachment.bin>


More information about the llvm-commits mailing list