[llvm] r215385 - Debug info: Further simplify the implementation of buildLocationList by

Adrian Prantl aprantl at apple.com
Mon Aug 11 14:05:57 PDT 2014


Author: adrian
Date: Mon Aug 11 16:05:57 2014
New Revision: 215385

URL: http://llvm.org/viewvc/llvm-project?rev=215385&view=rev
Log:
Debug info: Further simplify the implementation of buildLocationList by
getting rid of the redundant DIVariable in the OpenRanges pair.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=215385&r1=215384&r2=215385&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Aug 11 16:05:57 2014
@@ -1233,8 +1233,7 @@ static bool piecesOverlap(DIVariable P1,
 void
 DwarfDebug::buildLocationList(SmallVectorImpl<DebugLocEntry> &DebugLoc,
                               const DbgValueHistoryMap::InstrRanges &Ranges) {
-  typedef std::pair<DIVariable, DebugLocEntry::Value> Range;
-  SmallVector<Range, 4> OpenRanges;
+  SmallVector<DebugLocEntry::Value, 4> OpenRanges;
 
   for (auto I = Ranges.begin(), E = Ranges.end(); I != E; ++I) {
     const MachineInstr *Begin = I->first;
@@ -1251,9 +1250,10 @@ DwarfDebug::buildLocationList(SmallVecto
 
     // If this piece overlaps with any open ranges, truncate them.
     DIVariable DIVar = Begin->getDebugVariable();
-    auto Last = std::remove_if(OpenRanges.begin(), OpenRanges.end(), [&](Range R){
-        return piecesOverlap(DIVar, R.first);
-      });
+    auto Last = std::remove_if(OpenRanges.begin(), OpenRanges.end(),
+                  [&](DebugLocEntry::Value R) {
+                    return piecesOverlap(DIVar, DIVariable(R.getVariable()));
+                  });
     OpenRanges.erase(Last, OpenRanges.end());
 
     const MCSymbol *StartLabel = getLabelBeforeInsn(Begin);
@@ -1277,7 +1277,7 @@ DwarfDebug::buildLocationList(SmallVecto
     // If this is a piece, it may belong to the current DebugLocEntry.
     if (DIVar.isVariablePiece()) {
       // Add this value to the list of open ranges.
-      OpenRanges.push_back(std::make_pair(DIVar, Value));
+      OpenRanges.push_back(Value);
 
       // Attempt to add the piece to the last entry.
       if (!DebugLoc.empty())





More information about the llvm-commits mailing list