aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/SafeStack/AArch64/abi_ssp.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/Transforms/SafeStack/AArch64/abi_ssp.ll')
-rw-r--r--test/Transforms/SafeStack/AArch64/abi_ssp.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/Transforms/SafeStack/AArch64/abi_ssp.ll b/test/Transforms/SafeStack/AArch64/abi_ssp.ll
new file mode 100644
index 000000000000..5d584d0a76b9
--- /dev/null
+++ b/test/Transforms/SafeStack/AArch64/abi_ssp.ll
@@ -0,0 +1,22 @@
+; RUN: opt -safe-stack -S -mtriple=aarch64-linux-android < %s -o - | FileCheck --check-prefix=TLS %s
+
+
+define void @foo() nounwind uwtable safestack sspreq {
+entry:
+; The first @llvm.thread.pointer is for the unsafe stack pointer, skip it.
+; TLS: call i8* @llvm.thread.pointer()
+
+; TLS: %[[TP2:.*]] = call i8* @llvm.thread.pointer()
+; TLS: %[[B:.*]] = getelementptr i8, i8* %[[TP2]], i32 40
+; TLS: %[[C:.*]] = bitcast i8* %[[B]] to i8**
+; TLS: %[[StackGuard:.*]] = load i8*, i8** %[[C]]
+; TLS: store i8* %[[StackGuard]], i8** %[[StackGuardSlot:.*]]
+ %a = alloca i128, align 16
+ call void @Capture(i128* %a)
+
+; TLS: %[[A:.*]] = load i8*, i8** %[[StackGuardSlot]]
+; TLS: icmp ne i8* %[[StackGuard]], %[[A]]
+ ret void
+}
+
+declare void @Capture(i128*)