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 5 6define void @foo() nounwind uwtable safestack sspreq { 7entry: 8; The first @llvm.thread.pointer is for the unsafe stack pointer, skip it. 9; TLS: call ptr @llvm.thread.pointer() 10 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) 18 19; TLS: %[[A:.*]] = load ptr, ptr %[[StackGuardSlot]] 20; TLS: icmp ne ptr %[[StackGuard]], %[[A]] 21 ret void 22} 23 24declare void @Capture(ptr) 25