[PATCH] D147740: [NFC][llvm-profdata] Refactoring Sample Profile Reader to increase FDO build speed
David Li via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 25 08:59:38 PDT 2023
davidxl added inline comments.
================
Comment at: llvm/include/llvm/ProfileData/SampleProf.h:321
+static inline uint64_t hashFuncName(StringRef F) {
+ // If function name is already MD5 string, do not hash again.
----------------
F is not really function name, so may be called
hashFunc(StringRef NameOrMD5) { ...}
================
Comment at: llvm/include/llvm/ProfileData/SampleProf.h:1280
+/// Check for MD5 collision when inserting on SampleProfileMap. Any insertion to
+/// SampleProfileMap should use this function instead of emplace or operator[].
+static inline std::pair<SampleProfileMap::iterator, bool>
----------------
maybe define SampleProfileMap as a wrapper class and then forbid the unintended interfaces like operator[] ..
================
Comment at: llvm/include/llvm/ProfileData/SampleProfReader.h:415
+ uint64_t MD5 = MD5Hash(CanonName);
+ auto Ret = Profiles.try_emplace(MD5, FunctionSamples());
+ if (!Ret.second) {
----------------
Why not using the new interface SampleProfileMapTryEmplace?
================
Comment at: llvm/include/llvm/ProfileData/SampleProfReader.h:434
+ uint64_t MD5 = hashFuncName(Fname);
+ auto It = Profiles.find(MD5);
+ if (It != Profiles.end()) {
----------------
have a helper for the common code sequence?
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