Repository navigation
Conversation
286c2e7 to
156d80f
Compare
|
I'm curious about the motivation for your recent contributions - do you see bad performance wrt. TLS in your code? And significant improvements with e.g. this change here? I didn't expect that we'd have to take care about caching the thread-specific address manually in the IR frontend. And if the point is to avoid repeated __tls_get_addr calls etc., I suggest adding an according test with multiple usages (read/write) of a thread-local global in a single function - I guess you want a single |
Like clang, wrap TLS accesses in llvm.threadlocal.address so that LLVM can CSE/LICM the TLS address computation, e.g. avoiding repeated __tls_get_addr calls with the global-dynamic model.
156d80f to
3dc863a
Compare
Actually, no. Recently we've found that compared to clang/rust, ldc cannot generate optimized code for TLS accesses, so just tried to improve it. In most case linker relaxation already works well for executables; the main remaining case is shared libraries, but we didn't have a particular use case for it.
Ah, yes. I've updated the test the same way as clang. |
Like clang, wrap TLS accesses in llvm.threadlocal.address so that LLVM can CSE/LICM the TLS address computation, e.g. avoiding repeated __tls_get_addr calls with the global-dynamic model.