1 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s --check-prefix=TLS
2 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s --check-prefix=TLS
3 ; RUN: opt -safe-stack -S -mtriple=i686-linux-android < %s -o - | FileCheck %s --check-prefix=DIRECT-TLS32
4 ; RUN: opt -safe-stack -S -mtriple=x86_64-linux-android < %s -o - | FileCheck %s --check-prefix=DIRECT-TLS64
5 ; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s --check-prefix=TLS
6 ; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s --check-prefix=TLS
7 ; RUN: opt -passes=safe-stack -S -mtriple=i686-linux-android < %s -o - | FileCheck %s --check-prefix=DIRECT-TLS32
8 ; RUN: opt -passes=safe-stack -S -mtriple=x86_64-linux-android < %s -o - | FileCheck %s --check-prefix=DIRECT-TLS64
11 define void @foo() nounwind uwtable safestack {
13 ; TLS: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
14 ; TLS: %[[USST:.*]] = getelementptr i8, ptr %[[USP]], i32 -16
15 ; TLS: store ptr %[[USST]], ptr @__safestack_unsafe_stack_ptr
17 ; DIRECT-TLS32: %[[USP:.*]] = load ptr, ptr addrspace(256) inttoptr (i32 36 to ptr addrspace(256))
18 ; DIRECT-TLS32: %[[USST:.*]] = getelementptr i8, ptr %[[USP]], i32 -16
19 ; DIRECT-TLS32: store ptr %[[USST]], ptr addrspace(256) inttoptr (i32 36 to ptr addrspace(256))
21 ; DIRECT-TLS64: %[[USP:.*]] = load ptr, ptr addrspace(257) inttoptr (i32 72 to ptr addrspace(257))
22 ; DIRECT-TLS64: %[[USST:.*]] = getelementptr i8, ptr %[[USP]], i32 -16
23 ; DIRECT-TLS64: store ptr %[[USST]], ptr addrspace(257) inttoptr (i32 72 to ptr addrspace(257))
25 %a = alloca i8, align 8
26 call void @Capture(ptr %a)
28 ; TLS: store ptr %[[USP]], ptr @__safestack_unsafe_stack_ptr
29 ; DIRECT-TLS32: store ptr %[[USP]], ptr addrspace(256) inttoptr (i32 36 to ptr addrspace(256))
30 ; DIRECT-TLS64: store ptr %[[USP]], ptr addrspace(257) inttoptr (i32 72 to ptr addrspace(257))
34 declare void @Capture(ptr)