[PATCH] D108142: [SamplePGO] Fixing a memory issue when creating profiles on-demand

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 16 12:24:26 PDT 2021


wmi added inline comments.


================
Comment at: llvm/include/llvm/ProfileData/SampleProf.h:107-110
+  if (Name.empty() || !UseMD5)
     return Name;
   GUIDBuf = std::to_string(Function::getGUID(Name));
+  return GUIDBuf;
----------------
Thanks for the improvement.


================
Comment at: llvm/include/llvm/ProfileData/SampleProfReader.h:411
+    auto It = Profiles.find(CanonName);
+    if (It == Profiles.end()) {
+      if (!FGUID.empty()) {
----------------
Nit: 
```
if (It != Profiles.end())
  return &It->second;
...
```


================
Comment at: llvm/include/llvm/ProfileData/SampleProfReader.h:516
+  /// This should only be needed for md5 profiles.
+  std::set<std::string> MD5NameBuffer;
+
----------------
std::unordered_set is enough?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108142



More information about the llvm-commits mailing list