orcguru wrote:

> For below case:
> 
> ```
> __thread extern  int x = 42;
> __thread extern int y = 42;
> int main(void) {
>    return x + y;
> }
> ```
> 
> For now, we get:
> 
> ```
> .main:
> # %bb.0:                                # %entry
>         mflr 0
>         stwu 1, -32(1)
>         stw 0, 40(1)
>         lwz 6, L..C0(2)                         # target-flags(ppc-tlsld) @x
>         lwz 7, L..C1(2)                         # target-flags(ppc-tlsld) @y
>         lwz 3, L..C2(2)                         # target-flags(ppc-tlsld) 
> &"_$TLSML[TC]"
>         bla .__tls_get_mod[PR]
>         add 3, 3, 6
>         lwz 6, 0(3)
>         lwz 3, L..C2(2)                         # target-flags(ppc-tlsld) 
> &"_$TLSML[TC]"
>         bla .__tls_get_mod[PR]
>         add 3, 3, 7
>         lwz 3, 0(3)
>         add 3, 3, 6
>         addi 1, 1, 32
>         lwz 0, 8(1)
>         mtlr 0
>         blr
> ```
> 
> I think we should be able to save one `__tls_get_mod()`?
> 
> If this is not easy to optimize now, I'm OK we do this optimization later.

I think this has been addressed in 
[c5779c1](https://github.com/llvm/llvm-project/pull/66316/commits/c5779c1142936db45c1d0e2046ee5015a7d02fe9).
 TLSLDAIX nodes no longer have any parameter, they look the same to 
machine-cse, and so should be able to be eliminated now.

https://github.com/llvm/llvm-project/pull/66316
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to