(original) (raw)



On Sat, Oct 20, 2018 at 5:08 PM Nicolai Hähnle via llvm-dev <llvm-dev@lists.llvm.org> wrote:
Hi Yevgeny,

Just to make sure I'm understanding this correctly: When a thread has a
non-null option context, then options set in the global context will
have no effect at all for that thread. Right? (That's what I would
expect and what makes sense to me.)

Yes, but the global context has no effect on your thread only for those options that have been changed in this thread's context.
That is because a thread local copy of an option is created in the current thread context when this option is set by this thread or another thread with the same option context. If the option has not been set then its global value is used.
For your case, I would suggest that you explicitly set a new thread option context for every thread (or thread group) that uses LLVM. This way the threads/groups will not affect each other and will use the options in the copy-on-write way.
May be it makes sense to try playing with the tests in the patch to better understand the use model.

Thanks.
-Yevgeny Rouban