[llvm] r231748 - DwarfAccelTable: remove unneeded bucket terminators.

Frederic Riss friss at apple.com
Mon Mar 9 20:47:55 PDT 2015


Author: friss
Date: Mon Mar  9 22:47:55 2015
New Revision: 231748

URL: http://llvm.org/viewvc/llvm-project?rev=231748&view=rev
Log:
DwarfAccelTable: remove unneeded bucket terminators.

Last commit fixed the handling of hash collisions, but it introdcuced
unneeded bucket terminators in some places. The generated table was
correct, it can just be a tiny bit smaller. As the previous table was
correct, the test doesn't need updating. If we really wanted to test
this, I could add the section size to the dwarf dump and test for a
precise value there. IMO the correctness test is sufficient.

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

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp?rev=231748&r1=231747&r2=231748&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp Mon Mar  9 22:47:55 2015
@@ -205,8 +205,8 @@ void DwarfAccelTable::EmitOffsets(AsmPri
 // Terminate each HashData bucket with 0.
 void DwarfAccelTable::EmitData(AsmPrinter *Asm, DwarfDebug *D,
                                MCSymbol *StrSym) {
-  uint64_t PrevHash = UINT64_MAX;
   for (size_t i = 0, e = Buckets.size(); i < e; ++i) {
+    uint64_t PrevHash = UINT64_MAX;
     for (HashList::const_iterator HI = Buckets[i].begin(),
                                   HE = Buckets[i].end();
          HI != HE; ++HI) {
@@ -235,7 +235,8 @@ void DwarfAccelTable::EmitData(AsmPrinte
       PrevHash = (*HI)->HashValue;
     }
     // Emit the final end marker for the bucket.
-    Asm->EmitInt32(0);
+    if (!Buckets[i].empty())
+      Asm->EmitInt32(0);
   }
 }
 





More information about the llvm-commits mailing list