================ @@ -0,0 +1,165 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 +; RUN: llc < %s -mtriple=i686-unknown-unknown --relocation-model=pic -enable-tlsdesc | FileCheck %s --check-prefix=X86 +; RUN: llc < %s -mtriple=x86_64-pc-linux-gnux32 --relocation-model=pic -enable-tlsdesc | FileCheck %s --check-prefix=X32 +; RUN: llc < %s -mtriple=x86_64-unknown-unknown --relocation-model=pic -enable-tlsdesc | FileCheck %s --check-prefix=X64 + +@x = thread_local global i32 0, align 4 +@y = internal thread_local global i32 0, align 4 ---------------- frobtech wrote:
That example allows the variables to be optimized out entirely because there's no way they can ever be modified. https://godbolt.org/z/63oz4xrj1 shows an example where it's generating LD model accesses. Note that in some cases I've seen GCC generate a local anchor symbol instead of using `_TLS_MODULE_BASE_`. That is less optimal than using `_TLS_MODULE_BASE_`, because multiple uses of `_TLS_MODULE_BASE_` across multiple TUs can be resolved by the linker to a single GOT slot (pair), whereas a local anchor symbol will always have its own GOT slot (pair) that won't be shared with any other TU. https://github.com/llvm/llvm-project/pull/83136 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits