1 ; RUN: opt -safe-stack -S -mtriple=aarch64-linux-android < %s -o - | FileCheck --check-prefixes=TLS,ANDROID %s
2 ; RUN: opt -safe-stack -S -mtriple=aarch64-unknown-fuchsia < %s -o - | FileCheck --check-prefixes=TLS,FUCHSIA %s
4 define void @foo() nounwind uwtable safestack sspreq {
6 ; The first @llvm.thread.pointer is for the unsafe stack pointer, skip it.
7 ; TLS: call ptr @llvm.thread.pointer()
9 ; TLS: %[[TP2:.*]] = call ptr @llvm.thread.pointer()
10 ; ANDROID: %[[B:.*]] = getelementptr i8, ptr %[[TP2]], i32 40
11 ; FUCHSIA: %[[B:.*]] = getelementptr i8, ptr %[[TP2]], i32 -16
12 ; TLS: %[[StackGuard:.*]] = load ptr, ptr %[[B]]
13 ; TLS: store ptr %[[StackGuard]], ptr %[[StackGuardSlot:.*]]
14 %a = alloca i128, align 16
15 call void @Capture(ptr %a)
17 ; TLS: %[[A:.*]] = load ptr, ptr %[[StackGuardSlot]]
18 ; TLS: icmp ne ptr %[[StackGuard]], %[[A]]
22 declare void @Capture(ptr)