I was reading about Fiber Safe optimizations on MSDN. It says that
Data declared with __declspec(thread) is referenced through a thread-local storage (TLS) array. The TLS array is an array of addresses that the system maintains for each thread. Each address in this array gives the location of thread-local storage data. A fiber is a lightweight object that consists of a stack and a register context and can be scheduled on various threads. A fiber can run on any thread. Because a fiber may get swapped out and restarted later on a different thread, the address of the TLS array must not be cached or optimized as a common sub expression across a function call
What are fiber safe optimizations? What is the actual purpose of using it? Why they are saying that "Because a fiber may get swapped out and restarted later on a different thread, the address of the TLS array must not be cached or optimized as a common sub expression across a function call."? Why and when should it be prevented?