[PATCH] D59902: [COFF] Optimize range extension thunk insertion memory usage
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 27 22:11:04 PDT 2019
mstorsjo added inline comments.
================
Comment at: lld/COFF/Writer.cpp:460
+ // file. Only add each thunk once to each input file.
+ auto Insertion = ThunkSymtabIndices.insert({{File, Thunk}, ~0U});
+ uint32_t &ThunkSymbolIndex = Insertion.first->second;
----------------
ruiu wrote:
> mstorsjo wrote:
> > Does the initial value `~0U` actually matter here? If `Insertion.second` is true (if this was the first insertion), the value will be unconditionally overwritten anyway, right? (I guess it's a good sentinel to safeguard against not updating it though, so it's probably ok as such, just trying to grasp all aspects of this.)
> Yeah, it looks to me that this can be a set instead of a map, as it doesn't seem like it is using map values.
It does use them (that's ThunkSymbolIndex), but the initial value inserted into the map with the insert mrthod could be anything, as it is always overwritten if it actually was a new key.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59902/new/
https://reviews.llvm.org/D59902
More information about the llvm-commits
mailing list