[PATCH] D153486: [llvm-profdata] GUIDToFuncNameMap can be static

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 23 17:15:32 PDT 2023


hoy added a comment.

In D153486#4445656 <https://reviews.llvm.org/D153486#4445656>, @wenlei wrote:

> In D153486#4445610 <https://reviews.llvm.org/D153486#4445610>, @davidxl wrote:
>
>> We should consider having singleton instance and use LLVM's synchronization support to guard updating. Assuming updating the map is rare so the contention should have low runtime impact.
>
> Essentially this is per-module map that needs to be accessed from FunctionSamples. For local (non-distributed) ThinLTO, each thin-backend thread will build part of the map (for symbols in that module) and access that part of the map, so write is not uncommon and contention could be common. I think TLS is the best option if it's available to use.
>
> OTOH, what's the total size of FunctionSamples, and how significant is saving 8 byte in it?

TLS is now available since `LLVM_ENABLE_THREADS` is on by default, but on some platforms it's still off. A safe way might be to condition the current change under `LLVM_ENABLE_THREADS`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153486



More information about the llvm-commits mailing list