[PATCH] D53424: Enable thread specific cl::opt values for multi-threaded support

Yevgeny Rouban via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 22 21:56:54 PDT 2018


yrouban added a comment.

In https://reviews.llvm.org/D53424#1270961, @jfb wrote:

> The outcome you wants seems highly desirable. The method (thread local storage) doesn't seem desirable when `LLVMContext` could be used for this. It seems you've collected a list of `cl::opt` values which really shouldn't be per-process when using LLVM as a library. How about making that happen instead?


LLVMContext is not always created when //cl::opt//s are used. In other words, I intentionally made the use of this new feature (the thread local option context) wider than the scope of LLVMContext. Users can bind they LLVMContexts to the thread local option context as they needed. It can be done by creating a ContextValue along with LLVMContext and setting this ContextValues as the thread local option context for all threads that work with the LLVMContext instance.
I did not understand your point about collection a list of //cl::opt//s. I do not collect any lists. Instead, every thread local option context collects only those options that have been redefined for this context.


Repository:
  rL LLVM

https://reviews.llvm.org/D53424





More information about the llvm-commits mailing list