diff options
| author | Chih-Hung Hsieh <chh@google.com> | 2018-02-28 17:48:55 +0000 |
|---|---|---|
| committer | Chih-Hung Hsieh <chh@google.com> | 2018-02-28 17:48:55 +0000 |
| commit | 9f9e4681ace64e6200f82d9d7f011701fd4e9cc8 (patch) | |
| tree | 85cd726554c7030c6168567b5af93507d6996032 /llvm/test | |
| parent | 29abfe4a8fe08bdd2f1c3b9e139a4547eb9261cc (diff) | |
| download | bcm5719-llvm-9f9e4681ace64e6200f82d9d7f011701fd4e9cc8.tar.gz bcm5719-llvm-9f9e4681ace64e6200f82d9d7f011701fd4e9cc8.zip | |
[TLS] use emulated TLS if the target supports only this mode
Emulated TLS is enabled by llc flag -emulated-tls,
which is passed by clang driver.
When llc is called explicitly or from other drivers like LTO,
missing -emulated-tls flag would generate wrong TLS code for targets
that supports only this mode.
Now use useEmulatedTLS() instead of Options.EmulatedTLS to decide whether
emulated TLS code should be generated.
Unit tests are modified to run with and without the -emulated-tls flag.
Differential Revision: https://reviews.llvm.org/D42999
llvm-svn: 326341
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/CodeGen/AArch64/emutls.ll | 2 | ||||
| -rw-r--r-- | llvm/test/CodeGen/AArch64/emutls_generic.ll | 12 | ||||
| -rw-r--r-- | llvm/test/CodeGen/ARM/emutls.ll | 2 | ||||
| -rw-r--r-- | llvm/test/CodeGen/ARM/emutls_generic.ll | 11 | ||||
| -rw-r--r-- | llvm/test/CodeGen/Mips/emutls_generic.ll | 5 | ||||
| -rw-r--r-- | llvm/test/CodeGen/PowerPC/emutls_generic.ll | 7 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/emutls-pic.ll | 7 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/emutls-pie.ll | 11 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/emutls.ll | 9 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/emutls_generic.ll | 11 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/fast-isel-emutls.ll | 4 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/global-access-pie-copyrelocs.ll | 7 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/global-access-pie.ll | 7 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/tls-android-negative.ll | 3 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/tls-android.ll | 3 |
15 files changed, 98 insertions, 3 deletions
diff --git a/llvm/test/CodeGen/AArch64/emutls.ll b/llvm/test/CodeGen/AArch64/emutls.ll index 36b0ae47bd4..c322058a5f6 100644 --- a/llvm/test/CodeGen/AArch64/emutls.ll +++ b/llvm/test/CodeGen/AArch64/emutls.ll @@ -1,5 +1,7 @@ ; RUN: llc -emulated-tls -mtriple=aarch64-linux-android \ ; RUN: -relocation-model=pic -disable-fp-elim < %s | FileCheck -check-prefix=ARM64 %s +; RUN: llc -mtriple=aarch64-linux-android \ +; RUN: -relocation-model=pic -disable-fp-elim < %s | FileCheck -check-prefix=ARM64 %s ; Copied from X86/emutls.ll diff --git a/llvm/test/CodeGen/AArch64/emutls_generic.ll b/llvm/test/CodeGen/AArch64/emutls_generic.ll index f205078ed41..84083397288 100644 --- a/llvm/test/CodeGen/AArch64/emutls_generic.ll +++ b/llvm/test/CodeGen/AArch64/emutls_generic.ll @@ -9,6 +9,18 @@ ; RUN: llc < %s -emulated-tls -mtriple=aarch64-apple-darwin -O3 \ ; RUN: | FileCheck -check-prefix=DARWIN %s +; RUN: llc < %s -mtriple=aarch64-linux-android -relocation-model=pic \ +; RUN: | FileCheck -check-prefix=ARM_64 %s +; RUN: llc < %s -mtriple=aarch64-linux-android -relocation-model=pic -O3 \ +; RUN: | FileCheck -check-prefix=ARM_64 %s +; RUN: llc < %s -mtriple=aarch64-linux-android -O3 \ +; RUN: | FileCheck -check-prefix=ARM_64 %s +; aarch64-windows-gnu needs explicit -emulated-tls +; RUN: llc < %s -mtriple=aarch64-apple-darwin -O3 \ +; RUN: | FileCheck -check-prefix=NoEMU %s + +; NoEMU-NOT: __emutls + ; Make sure that TLS symbols are emitted in expected order. @external_x = external thread_local global i32, align 8 diff --git a/llvm/test/CodeGen/ARM/emutls.ll b/llvm/test/CodeGen/ARM/emutls.ll index e66d93ebcb8..48ea96f9a0b 100644 --- a/llvm/test/CodeGen/ARM/emutls.ll +++ b/llvm/test/CodeGen/ARM/emutls.ll @@ -1,5 +1,7 @@ ; RUN: llc -emulated-tls -mtriple=arm-linux-android \ ; RUN: -relocation-model=pic < %s | FileCheck -check-prefix=ARM32 %s +; RUN: llc -mtriple=arm-linux-android \ +; RUN: -relocation-model=pic < %s | FileCheck -check-prefix=ARM32 %s ; Copied from X86/emutls.ll diff --git a/llvm/test/CodeGen/ARM/emutls_generic.ll b/llvm/test/CodeGen/ARM/emutls_generic.ll index 8c1c40dd6ea..41a46b41b77 100644 --- a/llvm/test/CodeGen/ARM/emutls_generic.ll +++ b/llvm/test/CodeGen/ARM/emutls_generic.ll @@ -11,6 +11,17 @@ ; RUN: llc < %s -emulated-tls -mtriple=thumbv7-windows-gnu -O3 \ ; RUN: | FileCheck -check-prefix=WIN %s +; RUN: llc < %s -mtriple=arm-linux-android -relocation-model=pic \ +; RUN: | FileCheck -check-prefix=ARM_32 %s +; RUN: llc < %s -mtriple=arm-linux-androidabi -relocation-model=pic \ +; RUN: | FileCheck -check-prefix=ARM_32 %s +; RUN: llc < %s -mtriple=arm-linux-androidabi -relocation-model=pic -O3 \ +; RUN: | FileCheck -check-prefix=ARM_32 %s +; RUN: llc < %s -mtriple=arm-linux-androidabi -O3 \ +; RUN: | FileCheck -check-prefix=ARM_32 %s +; arm-apple-darwin must use -emulated-tls +; windows must use -emulated-tls + ; Make sure that TLS symbols are emitted in expected order. @external_x = external thread_local global i32, align 8 diff --git a/llvm/test/CodeGen/Mips/emutls_generic.ll b/llvm/test/CodeGen/Mips/emutls_generic.ll index cda8dec7d12..a529646b88f 100644 --- a/llvm/test/CodeGen/Mips/emutls_generic.ll +++ b/llvm/test/CodeGen/Mips/emutls_generic.ll @@ -3,6 +3,11 @@ ; RUN: llc < %s -emulated-tls -mtriple=mips64el-linux-android -relocation-model=pic \ ; RUN: | FileCheck -check-prefix=MIPS_64 %s +; RUN: llc < %s -mtriple=mipsel-linux-android -relocation-model=pic \ +; RUN: | FileCheck -check-prefix=MIPS_32 %s +; RUN: llc < %s -mtriple=mips64el-linux-android -relocation-model=pic \ +; RUN: | FileCheck -check-prefix=MIPS_64 %s + ; Make sure that TLS symbols are emitted in expected order. @external_x = external thread_local global i32, align 8 diff --git a/llvm/test/CodeGen/PowerPC/emutls_generic.ll b/llvm/test/CodeGen/PowerPC/emutls_generic.ll index a2e13a6723f..9a73a715f02 100644 --- a/llvm/test/CodeGen/PowerPC/emutls_generic.ll +++ b/llvm/test/CodeGen/PowerPC/emutls_generic.ll @@ -3,6 +3,13 @@ ; RUN: llc < %s -emulated-tls -mtriple=powerpc-unknown-linux-gnu -relocation-model=pic \ ; RUN: | FileCheck %s +; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -relocation-model=pic \ +; RUN: | FileCheck -check-prefix=NoEMU %s +; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu -relocation-model=pic \ +; RUN: | FileCheck -check-prefix=NoEMU %s + +; NoEMU-NOT: __emutls + ; Make sure that TLS symbols are emitted in expected order. @external_x = external thread_local global i32, align 8 diff --git a/llvm/test/CodeGen/X86/emutls-pic.ll b/llvm/test/CodeGen/X86/emutls-pic.ll index a83639d0f84..ef14c5c03c2 100644 --- a/llvm/test/CodeGen/X86/emutls-pic.ll +++ b/llvm/test/CodeGen/X86/emutls-pic.ll @@ -3,6 +3,13 @@ ; RUN: llc < %s -emulated-tls -mtriple=i386-linux-android -relocation-model=pic | FileCheck -check-prefix=X32 %s ; RUN: llc < %s -emulated-tls -mtriple=x86_64-linux-android -relocation-model=pic | FileCheck -check-prefix=X64 %s +; RUN: llc < %s -mtriple=i386-linux-gnu -relocation-model=pic | FileCheck -check-prefix=NoEMU %s +; RUN: llc < %s -mtriple=x86_64-linux-gnu -relocation-model=pic | FileCheck -check-prefix=NoEMU %s +; RUN: llc < %s -mtriple=i386-linux-android -relocation-model=pic | FileCheck -check-prefix=X32 %s +; RUN: llc < %s -mtriple=x86_64-linux-android -relocation-model=pic | FileCheck -check-prefix=X64 %s + +; NoEMU-NOT: __emutls + ; Use my_emutls_get_address like __emutls_get_address. @my_emutls_v_xyz = external global i8*, align 4 declare i8* @my_emutls_get_address(i8*) diff --git a/llvm/test/CodeGen/X86/emutls-pie.ll b/llvm/test/CodeGen/X86/emutls-pie.ll index 3c312a92669..4fa191c2267 100644 --- a/llvm/test/CodeGen/X86/emutls-pie.ll +++ b/llvm/test/CodeGen/X86/emutls-pie.ll @@ -7,6 +7,17 @@ ; RUN: llc < %s -emulated-tls -mcpu=generic -mtriple=x86_64-linux-android -relocation-model=pic \ ; RUN: | FileCheck -check-prefix=X64 %s +; RUN: llc < %s -mcpu=generic -mtriple=i386-linux-gnu -relocation-model=pic \ +; RUN: | FileCheck -check-prefix=NoEMU %s +; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux-gnu -relocation-model=pic \ +; RUN: | FileCheck -check-prefix=NoEMU %s +; RUN: llc < %s -mcpu=generic -mtriple=i386-linux-android -relocation-model=pic \ +; RUN: | FileCheck -check-prefix=X32 %s +; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux-android -relocation-model=pic \ +; RUN: | FileCheck -check-prefix=X64 %s + +; NoEMU-NOT: __emutls + ; Use my_emutls_get_address like __emutls_get_address. @my_emutls_v_xyz = external global i8*, align 4 declare i8* @my_emutls_get_address(i8*) diff --git a/llvm/test/CodeGen/X86/emutls.ll b/llvm/test/CodeGen/X86/emutls.ll index 8c0ba903659..5b1c0395fcc 100644 --- a/llvm/test/CodeGen/X86/emutls.ll +++ b/llvm/test/CodeGen/X86/emutls.ll @@ -3,8 +3,15 @@ ; RUN: llc < %s -emulated-tls -mtriple=i386-linux-android | FileCheck -check-prefix=X32 %s ; RUN: llc < %s -emulated-tls -mtriple=x86_64-linux-android | FileCheck -check-prefix=X64 %s +; RUN: llc < %s -mtriple=i386-linux-gnu | FileCheck -check-prefix=NoEMU %s +; RUN: llc < %s -mtriple=x86_64-linux-gnu | FileCheck -check-prefix=NoEMU %s +; RUN: llc < %s -mtriple=i386-linux-android | FileCheck -check-prefix=X32 %s +; RUN: llc < %s -mtriple=x86_64-linux-android | FileCheck -check-prefix=X64 %s + ; Copied from tls.ll; emulated TLS model is not implemented -; for *-pc-win32 and *-pc-winows targets yet. +; for *-pc-win32 and *-pc-windows targets yet. + +; NoEMU-NOT: __emutls ; Use my_emutls_get_address like __emutls_get_address. @my_emutls_v_xyz = external global i8*, align 4 diff --git a/llvm/test/CodeGen/X86/emutls_generic.ll b/llvm/test/CodeGen/X86/emutls_generic.ll index 0c534f370ef..7fc6089b907 100644 --- a/llvm/test/CodeGen/X86/emutls_generic.ll +++ b/llvm/test/CodeGen/X86/emutls_generic.ll @@ -7,6 +7,17 @@ ; RUN: llc < %s -emulated-tls -mtriple=i386-linux-gnu -relocation-model=pic \ ; RUN: | FileCheck %s +; RUN: llc < %s -mtriple=i686-linux-android -relocation-model=pic \ +; RUN: | FileCheck -check-prefix=X86_32 %s +; RUN: llc < %s -mtriple=i686-linux-android -relocation-model=pic \ +; RUN: | FileCheck -check-prefix=X86_32 %s +; RUN: llc < %s -mtriple=x86_64-linux-android -relocation-model=pic \ +; RUN: | FileCheck -check-prefix=X86_64 %s +; RUN: llc < %s -mtriple=i386-linux-gnu -relocation-model=pic \ +; RUN: | FileCheck -check-prefix=NoEMU %s + +; NoEMU-NOT: __emutls + ; Make sure that TLS symbols are emitted in expected order. @external_x = external thread_local global i32, align 8 diff --git a/llvm/test/CodeGen/X86/fast-isel-emutls.ll b/llvm/test/CodeGen/X86/fast-isel-emutls.ll index 0a7f5d451ee..1eeb66bd64c 100644 --- a/llvm/test/CodeGen/X86/fast-isel-emutls.ll +++ b/llvm/test/CodeGen/X86/fast-isel-emutls.ll @@ -1,6 +1,10 @@ ; RUN: llc < %s -emulated-tls -relocation-model=pic -mtriple=i686-unknown-linux-gnu -fast-isel | FileCheck %s +; RUN: llc < %s -relocation-model=pic -mtriple=i686-unknown-linux-gnu -fast-isel \ +; RUN: | FileCheck -check-prefix=NoEMU %s ; PR3654 +; NoEMU-NOT: __emutls + @v = thread_local global i32 0 define i32 @f() nounwind { entry: diff --git a/llvm/test/CodeGen/X86/global-access-pie-copyrelocs.ll b/llvm/test/CodeGen/X86/global-access-pie-copyrelocs.ll index 0918793a4d2..3cd75c791a6 100644 --- a/llvm/test/CodeGen/X86/global-access-pie-copyrelocs.ll +++ b/llvm/test/CodeGen/X86/global-access-pie-copyrelocs.ll @@ -1,8 +1,13 @@ -; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux-gnu -relocation-model=pic -pie-copy-relocations \ +; RUN: llc < %s -emulated-tls -mcpu=generic -mtriple=x86_64-linux-gnu -relocation-model=pic -pie-copy-relocations \ ; RUN: | FileCheck -check-prefix=X64 %s ; RUN: llc < %s -emulated-tls -mcpu=generic -mtriple=i386-linux-gnu -relocation-model=pic -pie-copy-relocations \ ; RUN: | FileCheck -check-prefix=X32 %s +; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux-gnu -relocation-model=pic -pie-copy-relocations \ +; RUN: | FileCheck -check-prefix=X64 %s +; RUN: llc < %s -mcpu=generic -mtriple=i386-linux-gnu -relocation-model=pic -pie-copy-relocations \ +; RUN: | FileCheck -check-prefix=X32 %s + ; External Linkage @a = global i32 0, align 4 diff --git a/llvm/test/CodeGen/X86/global-access-pie.ll b/llvm/test/CodeGen/X86/global-access-pie.ll index 98dbcce9b77..d074f9fab8b 100644 --- a/llvm/test/CodeGen/X86/global-access-pie.ll +++ b/llvm/test/CodeGen/X86/global-access-pie.ll @@ -1,8 +1,13 @@ -; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux-gnu -relocation-model=pic \ +; RUN: llc < %s -emulated-tls -mcpu=generic -mtriple=x86_64-linux-gnu -relocation-model=pic \ ; RUN: | FileCheck -check-prefix=X64 %s ; RUN: llc < %s -emulated-tls -mcpu=generic -mtriple=i386-linux-gnu -relocation-model=pic \ ; RUN: | FileCheck -check-prefix=X32 %s +; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux-gnu -relocation-model=pic \ +; RUN: | FileCheck -check-prefix=X64 %s +; RUN: llc < %s -mcpu=generic -mtriple=i386-linux-gnu -relocation-model=pic \ +; RUN: | FileCheck -check-prefix=X32 %s + ; External Linkage @a = global i32 0, align 4 diff --git a/llvm/test/CodeGen/X86/tls-android-negative.ll b/llvm/test/CodeGen/X86/tls-android-negative.ll index 7a767cabb05..dc4ac8ff47d 100644 --- a/llvm/test/CodeGen/X86/tls-android-negative.ll +++ b/llvm/test/CodeGen/X86/tls-android-negative.ll @@ -1,6 +1,9 @@ ; RUN: llc < %s -emulated-tls -mtriple=i686-linux-android -relocation-model=pic | FileCheck %s ; RUN: llc < %s -emulated-tls -mtriple=x86_64-linux-android -relocation-model=pic | FileCheck %s +; RUN: llc < %s -mtriple=i686-linux-android -relocation-model=pic | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux-android -relocation-model=pic | FileCheck %s + ; Make sure that some symboles are not emitted in emulated TLS model. @external_x = external thread_local global i32 diff --git a/llvm/test/CodeGen/X86/tls-android.ll b/llvm/test/CodeGen/X86/tls-android.ll index ecb9b430a7c..772a2371e42 100644 --- a/llvm/test/CodeGen/X86/tls-android.ll +++ b/llvm/test/CodeGen/X86/tls-android.ll @@ -1,6 +1,9 @@ ; RUN: llc < %s -emulated-tls -mtriple=i686-linux-android -relocation-model=pic | FileCheck %s ; RUN: llc < %s -emulated-tls -mtriple=x86_64-linux-android -relocation-model=pic | FileCheck -check-prefix=X64 %s +; RUN: llc < %s -mtriple=i686-linux-android -relocation-model=pic | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux-android -relocation-model=pic | FileCheck -check-prefix=X64 %s + ; Make sure that TLS symboles are emitted in expected order. @external_x = external thread_local global i32 |

