[PATCH] D104267: [CSSPGO] Fix an invalid hash table reference issue in the CS preinliner.

Lei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 16 12:47:12 PDT 2021


wlei added inline comments.


================
Comment at: llvm/lib/ProfileData/SampleProf.cpp:394
+    auto Ret = ProfilesToBeAdded.try_emplace(ContextStr, FProfile);
+    (void)Ret;
     assert(Ret.second && "Conext conflict during canonicalization");
----------------
hoy wrote:
> wlei wrote:
> > hoy wrote:
> > > wlei wrote:
> > > > Do we need this?
> > > It's to make sure `Ret` is used in the release build where the following `assert` turns out nothing. Otherwise the ninja complaints `Ret` is defined by not used.
> > I see, how about we use `find` instead of `try_emplace`, like `assert(ProfilesToBeAdded.find(ContextStr) == ProfilesToBeAdded.end() && "Context conflict during canonicalization");`
> That looks better but may slow down the assert compiler. Actually the `(void)` usage is quite common in the code base. 
Now I got it, thanks for the clarification.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104267



More information about the llvm-commits mailing list