Rafael Espíndola
2012-Jun-12 16:36 UTC
[LLVMdev] [Patch, RFC] Re: Adding support for explicitly specified TLS models (PR9788)
>> Do you know what is the rationale for that? The static linker will >> optimize it anyway (but not do as good a job as the compiler could). > > codegen can be more efficient. E.g. less or no calls to __tls_get_addr > needed.My point also :-) What I was asking for a rationale on was *not* doing the optimization in the compiler.> JoergCheers, Rafael
Joerg Sonnenberger
2012-Jun-12 18:05 UTC
[LLVMdev] [Patch, RFC] Re: Adding support for explicitly specified TLS models (PR9788)
On Tue, Jun 12, 2012 at 12:36:28PM -0400, Rafael Espíndola wrote:> >> Do you know what is the rationale for that? The static linker will > >> optimize it anyway (but not do as good a job as the compiler could). > > > > codegen can be more efficient. E.g. less or no calls to __tls_get_addr > > needed. > > My point also :-) What I was asking for a rationale on was *not* doing > the optimization in the compiler.Ah, sorry. Because the compiler might not know it yet. Consider linking code compiled with -fPIC into the main binary, either using PIE or not. Joerg
Hans Wennborg
2012-Jun-12 18:21 UTC
[LLVMdev] [llvm-commits] [Patch, RFC] Re: Adding support for explicitly specified TLS models (PR9788)
On Tue, Jun 12, 2012 at 7:05 PM, Joerg Sonnenberger <joerg at britannica.bec.de> wrote:> On Tue, Jun 12, 2012 at 12:36:28PM -0400, Rafael Espíndola wrote: >> >> Do you know what is the rationale for that? The static linker will >> >> optimize it anyway (but not do as good a job as the compiler could). >> > >> > codegen can be more efficient. E.g. less or no calls to __tls_get_addr >> > needed. >> >> My point also :-) What I was asking for a rationale on was *not* doing >> the optimization in the compiler. > > Ah, sorry. Because the compiler might not know it yet. Consider linking > code compiled with -fPIC into the main binary, either using PIE or not.Right, but the issue we're discussing here, is why GCC chooses to not optimize a variable like this: static __thread int __attribute((tls_model("global-dynamic"))) x; even if it could (e.g. when compiled without -fpic). We're trying to figure out if there's a good reason for this, and if we want to mimic that behaviour in LLVM, or if we should just take the tls_model attribute as a starting point, and choose a better model if we can. - Hans
Rafael Espíndola
2012-Jun-13 13:12 UTC
[LLVMdev] [Patch, RFC] Re: Adding support for explicitly specified TLS models (PR9788)
> Ah, sorry. Because the compiler might not know it yet. Consider linking > code compiled with -fPIC into the main binary, either using PIE or not.Yes, the case that is interesting is where both can. Why should the compiler wait for the linker?> JoergCheers, Rafael
Apparently Analagous Threads
- [LLVMdev] [llvm-commits] [Patch, RFC] Re: Adding support for explicitly specified TLS models (PR9788)
- [LLVMdev] [llvm-commits] [Patch, RFC] Re: Adding support for explicitly specified TLS models (PR9788)
- [LLVMdev] [Patch, RFC] Re: Adding support for explicitly specified TLS models (PR9788)
- [LLVMdev] [Patch, RFC] Re: Adding support for explicitly specified TLS models (PR9788)
- [LLVMdev] Adding support for explicitly specified TLS models (PR9788)