[safestack] Fast access to the unsafe stack pointer on AArch64/Android.
[oota-llvm.git] / test / Transforms / SafeStack / AArch64 / abi.ll
1 ; RUN: opt -safe-stack -S -mtriple=aarch64-linux-android < %s -o - | FileCheck %s
2
3
4 define void @foo() nounwind uwtable safestack {
5 entry:
6 ; CHECK: %[[TP:.*]] = call i8* @llvm.aarch64.thread.pointer()
7 ; CHECK: %[[SPA0:.*]] = getelementptr i8, i8* %[[TP]], i32 72
8 ; CHECK: %[[SPA:.*]] = bitcast i8* %[[SPA0]] to i8**
9 ; CHECK: %[[USP:.*]] = load i8*, i8** %[[SPA]]
10 ; CHECK: %[[USST:.*]] = getelementptr i8, i8* %[[USP]], i32 -16
11 ; CHECK: store i8* %[[USST]], i8** %[[SPA]]
12
13   %a = alloca i8, align 8
14   call void @Capture(i8* %a)
15
16 ; CHECK: store i8* %[[USP]], i8** %[[SPA]]
17   ret void
18 }
19
20 declare void @Capture(i8*)