[PATCH] D43073: [CodeGen] Optimize AccelTable

Pavel Labath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 9 04:24:10 PST 2018


labath added inline comments.


================
Comment at: llvm/trunk/include/llvm/CodeGen/AccelTable.h:239
 
-  std::vector<HashData *> Data;
-
-  using StringEntries = StringMap<DataArray, BumpPtrAllocator &>;
+  using StringEntries = StringMap<HashData, BumpPtrAllocator &>;
   StringEntries Entries;
----------------
I see one more (and possibly bigger) improvement that we can make here:
This string map will store a copy of the string from the HashData structure (along with it's hash, which it will need to recompute). However, HashData already contains a hash *and* the string, which has even been uniqued by the dwarf string pool.

So, we could store the HashData in a DenseMap (with a custom DenseMapInfo) and save both space (no string copies) and time (efficient equality comparison).

The only additional requirement here would be that all the `DwarfStringPoolEntryRef`s come from a single string pool. As far as I can tell, this is already the case (and I can't imagine why one would do it differently), but I don't see a way to enforce that in code.

WDYT?


Repository:
  rL LLVM

https://reviews.llvm.org/D43073





More information about the llvm-commits mailing list