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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 4 16:23:07 PST 2018


MaskRay accepted this revision.
MaskRay added a comment.

I didn't notice this patch when I sent out D55248 <https://reviews.llvm.org/D55248> (I just observed a locally-invented upper_bound without a good justification :) ).

I agree that the memory-consuming `llvm::DenseMap<uint32_t, uint32_t> OffsetMap;` is not necessary. (just for the record, gold `Object_merge_map::get_output_offset` uses a similar upper_bound without a hash table).

If we do want to optimize `llvm::upper_bound`, however, I think a one-entry cache (`size_t LastIdx; size_t LastOffset;`) may be more efficient, I've checked locally that many uses follow the pattern of calling `getSectionPiece` with increasing `Offset`.


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

https://reviews.llvm.org/D55234





More information about the llvm-commits mailing list