[PATCH] D147740: [llvm-profdata] Refactoring Sample Profile Reader to increase FDO build speed using MD5 as key to Sample Profile map
William Junda Huang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 1 13:56:36 PDT 2023
huangjd added inline comments.
================
Comment at: llvm/include/llvm/ProfileData/SampleProf.h:1292
+ std::pair<iterator, bool>
+ try_emplace(const key_type &Key, const SampleContext &Ctx, Ts &&...Args) {
+ assert(Key == Ctx.getHashCode());
----------------
davidxl wrote:
> Since this forces insert in case of conflict, should it be called just 'emplace'?
try_emplace functionally is same as emplace (https://en.cppreference.com/w/cpp/container/unordered_map/try_emplace), only difference is that try_emplace does not move the arguments to construct a mapped_type if key exists.
================
Comment at: llvm/include/llvm/ProfileData/SampleProf.h:1315
+ template <typename... Ts>
+ std::pair<iterator, bool> emplace(const SampleContext &Ctx, Ts &&...Args) {
+ return try_emplace(Ctx, std::forward<Ts>(Args)...);
----------------
davidxl wrote:
> what is the purpose of this wrapper?
existing code compatibility
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147740/new/
https://reviews.llvm.org/D147740
More information about the llvm-commits
mailing list