aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/TapiFile.cpp
diff options
context:
space:
mode:
authorRiver Riddle <riddleriver@gmail.com>2020-10-16 11:56:43 -0700
committerRiver Riddle <riddleriver@gmail.com>2020-10-16 12:08:48 -0700
commitf3df3b58e7dd7c400f9c18d16d92631823705ebd (patch)
tree6bb87c9ede4e3fb0956922fa54e51084686b13d9 /llvm/lib/Object/TapiFile.cpp
parentdd4e8a54b2ba9cec78441ba537b94f4eaa5acd84 (diff)
downloadllvm-f3df3b58e7dd7c400f9c18d16d92631823705ebd.zip
llvm-f3df3b58e7dd7c400f9c18d16d92631823705ebd.tar.gz
llvm-f3df3b58e7dd7c400f9c18d16d92631823705ebd.tar.bz2
[mlir] Add a utility class, ThreadLocalCache, for storing non static thread local objects.
(Note: This is a reland of D82597) This class allows for defining thread local objects that have a set non-static lifetime. This internals of the cache use a static thread_local map between the various different non-static objects and the desired value type. When a non-static object destructs, it simply nulls out the entry in the static map. This will leave an entry in the map, but erase any of the data for the associated value. The current use cases for this are in the MLIRContext, meaning that the number of items in the static map is ~1-2 which aren't particularly costly enough to warrant the complexity of pruning. If a use case arises that requires pruning of the map, the functionality can be added. This is especially useful in the context of MLIR for implementing thread-local caching of context level objects that would otherwise have very high lock contention. This revision adds a thread local cache in the MLIRContext for attributes, identifiers, and types to reduce some of the locking burden. This led to a speedup of several seconds when compiling a somewhat large mlir module. Differential Revision: https://reviews.llvm.org/D89504
Diffstat (limited to 'llvm/lib/Object/TapiFile.cpp')
0 files changed, 0 insertions, 0 deletions