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

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 16 12:49:47 PDT 2021


hoy added inline comments.


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


================
Comment at: llvm/include/llvm/ProfileData/SampleProfReader.h:516
+  /// This should only be needed for md5 profiles.
+  std::set<std::string> MD5NameBuffer;
+
----------------
wmi wrote:
> std::unordered_set is enough?
Oops, that's what I meant to use. Good catch. Thanks.


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