[llvm] r185842 - DebugInfo: Simplify Address Pool index handling.

David Blaikie dblaikie at gmail.com
Mon Jul 8 10:33:10 PDT 2013


Author: dblaikie
Date: Mon Jul  8 12:33:10 2013
New Revision: 185842

URL: http://llvm.org/viewvc/llvm-project?rev=185842&view=rev
Log:
DebugInfo: Simplify Address Pool index handling.

Since the pool indexes are necessarily sequential and contiguous, just
insert things in the right place rather than having to sort the sequence
after the fact.

No functionality change.

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=185842&r1=185841&r2=185842&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Jul  8 12:33:10 2013
@@ -2385,19 +2385,17 @@ void DwarfUnits::emitAddresses(const MCS
 
   // Get all of the address pool entries and put them in an array by their ID so
   // we can sort them.
-  SmallVector<std::pair<unsigned, const MCExpr *>, 64> Entries;
+  SmallVector<const MCExpr *, 64> Entries(AddressPool.size());
 
   for (DenseMap<const MCExpr *, unsigned>::iterator
            I = AddressPool.begin(),
            E = AddressPool.end();
        I != E; ++I)
-    Entries.push_back(std::make_pair(I->second, I->first));
-
-  array_pod_sort(Entries.begin(), Entries.end());
+    Entries[I->second] = I->first;
 
   for (unsigned i = 0, e = Entries.size(); i != e; ++i) {
     // Emit an expression for reference from debug information entries.
-    if (const MCExpr *Expr = Entries[i].second)
+    if (const MCExpr *Expr = Entries[i])
       Asm->OutStreamer.EmitValue(Expr, Asm->getDataLayout().getPointerSize());
     else
       Asm->OutStreamer.EmitIntValue(0, Asm->getDataLayout().getPointerSize());





More information about the llvm-commits mailing list