[llvm] [PowerPC] Support local-dynamic TLS relocation on AIX (PR #66316)
Chen Zheng via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 21 01:24:19 PDT 2023
https://github.com/chenzheng1030 commented:
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.
https://github.com/llvm/llvm-project/pull/66316
More information about the llvm-commits
mailing list