[PATCH] D57145: [DebugInfo] Remove redundant initialization of DbgVariable's MInsn, NFC

David Stenberg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 24 02:43:12 PST 2019


dstenb created this revision.
dstenb added reviewers: dblaikie, probinson, aprantl.
dstenb added a project: debug-info.
Herald added a subscriber: llvm-commits.

When building a location list, the first debug value for a variable was
passed to DebugLocStream::ListBuilder. Later on, in ListBuilder()'s
destructor, initializeDbgValue() was called with the passed debug value,
setting the DbgVariable's MInsn pointer. A non-null MInsn says that the
variable is described by a single debug value through the variable's
scope, which is not the case when we have begun building a location
list.

In DwarfCompileUnit::constructVariableDIEImpl(), the presence of a
location list index is checked before emitting a single location, so
setting MInsn for variables expressed by location lists did not have any
effect in practice. However, as it is unnecessary with the current code
base, remove that initialization.

I have verified that `llvm-dwarfdump -v' produces the same location
output with respectively without this patch when building a
RelWithDebInfo-profiled clang-tblgen binary.


Repository:
  rL LLVM

https://reviews.llvm.org/D57145

Files:
  lib/CodeGen/AsmPrinter/DebugLocStream.cpp
  lib/CodeGen/AsmPrinter/DebugLocStream.h
  lib/CodeGen/AsmPrinter/DwarfDebug.cpp


Index: lib/CodeGen/AsmPrinter/DwarfDebug.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1355,7 +1355,7 @@
       continue;
 
     // Handle multiple DBG_VALUE instructions describing one variable.
-    DebugLocStream::ListBuilder List(DebugLocs, TheCU, *Asm, *RegVar, *MInsn);
+    DebugLocStream::ListBuilder List(DebugLocs, TheCU, *Asm, *RegVar);
 
     // Build the location list for this variable.
     SmallVector<DebugLocEntry, 8> Entries;
Index: lib/CodeGen/AsmPrinter/DebugLocStream.h
===================================================================
--- lib/CodeGen/AsmPrinter/DebugLocStream.h
+++ lib/CodeGen/AsmPrinter/DebugLocStream.h
@@ -154,13 +154,12 @@
   DebugLocStream &Locs;
   AsmPrinter &Asm;
   DbgVariable &V;
-  const MachineInstr &MI;
   size_t ListIndex;
 
 public:
   ListBuilder(DebugLocStream &Locs, DwarfCompileUnit &CU, AsmPrinter &Asm,
-              DbgVariable &V, const MachineInstr &MI)
-      : Locs(Locs), Asm(Asm), V(V), MI(MI), ListIndex(Locs.startList(&CU)) {}
+              DbgVariable &V)
+      : Locs(Locs), Asm(Asm), V(V), ListIndex(Locs.startList(&CU)) {}
 
   /// Finalize the list.
   ///
Index: lib/CodeGen/AsmPrinter/DebugLocStream.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/DebugLocStream.cpp
+++ lib/CodeGen/AsmPrinter/DebugLocStream.cpp
@@ -40,6 +40,6 @@
 DebugLocStream::ListBuilder::~ListBuilder() {
   if (!Locs.finalizeList(Asm))
     return;
-  V.initializeDbgValue(&MI);
+  assert(!V.getMInsn() && "Already initialized with a single DBG_VALUE");
   V.setDebugLocListIndex(ListIndex);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57145.183277.patch
Type: text/x-patch
Size: 1719 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190124/09774ace/attachment.bin>


More information about the llvm-commits mailing list