[PATCH] D153771: [BOLT][Instrumentation] Fix hash table memory corruption and append-pid option

Denis Revunov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 01:15:22 PDT 2023


treapster added inline comments.


================
Comment at: bolt/runtime/instr.cpp:254
   uint64_t Val;
+  void report(const char *Msg = nullptr) {
+    char Buf[BufSize];
----------------
rafauler wrote:
> report -> dump
> 
> see Graph::dump() for an easier way to write (and read) this code
> 
> also include a call to this function inside a DEBUG() macro to showcase how/where you want this printed. If you don't want to always print it in debug, leave it commented out, so at least we know how to use it when we need it.
It is done this way because we want to construct a string once and print it atomically in a single call to write(). If write is called more than once, we get garbage when threads and processes are involved.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153771



More information about the llvm-commits mailing list