[PATCH] D147718: [DbgHistoryCalculator] Improve debug messages

Felipe de Azevedo Piovezan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 11 05:49:56 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGb2020fe3aab0: [DbgHistoryCalculator] Improve debug messages (authored by fdeazeve).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147718

Files:
  llvm/include/llvm/CodeGen/DbgEntityHistoryCalculator.h
  llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
  llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp


Index: llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
@@ -273,7 +273,7 @@
   InstOrdering.initialize(*MF);
   if (TrimVarLocs)
     DbgValues.trimLocationRanges(*MF, LScopes, InstOrdering);
-  LLVM_DEBUG(DbgValues.dump());
+  LLVM_DEBUG(DbgValues.dump(MF->getName()));
 
   // Request labels for the full history.
   for (const auto &I : DbgValues) {
Index: llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
@@ -138,6 +138,9 @@
   // references if any entries are removed.
   SmallVector<size_t, 4> Offsets;
 
+  LLVM_DEBUG(dbgs() << "Trimming location ranges for function '" << MF.getName()
+                    << "'\n");
+
   for (auto &Record : VarEntries) {
     auto &HistoryMapEntries = Record.second;
     if (HistoryMapEntries.empty())
@@ -213,6 +216,8 @@
         // count of the closing entry, if one exists.
         if (EndIndex != NoEntry)
           ReferenceCount[EndIndex] -= 1;
+        LLVM_DEBUG(dbgs() << "Dropping value outside scope range of variable: ";
+                   StartMI->print(llvm::dbgs()););
       }
     }
 
@@ -253,6 +258,8 @@
     // ToRemove indices are valid after each erase.
     for (EntryIndex Idx : llvm::reverse(ToRemove))
       HistoryMapEntries.erase(HistoryMapEntries.begin() + Idx);
+    LLVM_DEBUG(llvm::dbgs() << "New HistoryMap('" << LocalVar->getName()
+                            << "') size: " << HistoryMapEntries.size() << "\n");
   }
 }
 
@@ -555,8 +562,8 @@
 }
 
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-LLVM_DUMP_METHOD void DbgValueHistoryMap::dump() const {
-  dbgs() << "DbgValueHistoryMap:\n";
+LLVM_DUMP_METHOD void DbgValueHistoryMap::dump(StringRef FuncName) const {
+  dbgs() << "DbgValueHistoryMap('" << FuncName << "'):\n";
   for (const auto &VarRangePair : *this) {
     const InlinedEntity &Var = VarRangePair.first;
     const Entries &Entries = VarRangePair.second;
Index: llvm/include/llvm/CodeGen/DbgEntityHistoryCalculator.h
===================================================================
--- llvm/include/llvm/CodeGen/DbgEntityHistoryCalculator.h
+++ llvm/include/llvm/CodeGen/DbgEntityHistoryCalculator.h
@@ -122,7 +122,7 @@
   EntriesMap::const_iterator end() const { return VarEntries.end(); }
 
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-  LLVM_DUMP_METHOD void dump() const;
+  LLVM_DUMP_METHOD void dump(StringRef FuncName) const;
 #endif
 };
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147718.512412.patch
Type: text/x-patch
Size: 2740 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230411/4556d265/attachment.bin>


More information about the llvm-commits mailing list