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