[PATCH] D55234: Do not use a hash table to uniquify mergeable strings.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 5 11:16:31 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL348401: Do not use a hash table to uniquify mergeable strings. (authored by ruiu, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D55234?vs=176474&id=176860#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D55234

Files:
  lld/trunk/ELF/InputSection.cpp
  lld/trunk/ELF/InputSection.h


Index: lld/trunk/ELF/InputSection.cpp
===================================================================
--- lld/trunk/ELF/InputSection.cpp
+++ lld/trunk/ELF/InputSection.cpp
@@ -1206,21 +1206,12 @@
     splitStrings(data(), Entsize);
   else
     splitNonStrings(data(), Entsize);
-
-  OffsetMap.reserve(Pieces.size());
-  for (size_t I = 0, E = Pieces.size(); I != E; ++I)
-    OffsetMap[Pieces[I].InputOff] = I;
 }
 
 SectionPiece *MergeInputSection::getSectionPiece(uint64_t Offset) {
   if (this->data().size() <= Offset)
     fatal(toString(this) + ": offset is outside the section");
 
-  // Find a piece starting at a given offset.
-  auto It = OffsetMap.find(Offset);
-  if (It != OffsetMap.end())
-    return &Pieces[It->second];
-
   // If Offset is not at beginning of a section piece, it is not in the map.
   // In that case we need to  do a binary search of the original section piece vector.
   auto It2 =
Index: lld/trunk/ELF/InputSection.h
===================================================================
--- lld/trunk/ELF/InputSection.h
+++ lld/trunk/ELF/InputSection.h
@@ -253,7 +253,6 @@
   // Splittable sections are handled as a sequence of data
   // rather than a single large blob of data.
   std::vector<SectionPiece> Pieces;
-  llvm::DenseMap<uint32_t, uint32_t> OffsetMap;
 
   // Returns I'th piece's data. This function is very hot when
   // string merging is enabled, so we want to inline.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55234.176860.patch
Type: text/x-patch
Size: 1427 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181205/034978b6/attachment.bin>


More information about the llvm-commits mailing list