1 ; RUN: llc -mtriple=arm64-apple-macosx -fast-isel %s -o - -start-before=stack-protector -stop-after=stack-protector | FileCheck %s
7 define void @caller1() ssp {
8 ; CHECK-LABEL: define void @caller1()
10 ; CHECK: @llvm.stackguard
12 ; CHECK: [[GUARD:%.*]] = call ptr @llvm.stackguard()
13 ; CHECK: [[TOKEN:%.*]] = load volatile ptr, ptr {{%.*}}
14 ; CHECK: [[TST:%.*]] = icmp eq ptr [[GUARD]], [[TOKEN]]
15 ; CHECK: br i1 [[TST]]
17 ; CHECK: musttail call void @callee()
18 ; CHECK-NEXT: ret void
19 %var = alloca [2 x i64]
20 store ptr %var, ptr @var
21 musttail call void @callee()
25 define void @justret() ssp {
26 ; CHECK-LABEL: define void @justret()
28 ; CHECK: @llvm.stackguard
30 ; CHECK: [[GUARD:%.*]] = call ptr @llvm.stackguard()
31 ; CHECK: [[TOKEN:%.*]] = load volatile ptr, ptr {{%.*}}
32 ; CHECK: [[TST:%.*]] = icmp eq ptr [[GUARD]], [[TOKEN]]
33 ; CHECK: br i1 [[TST]]
36 %var = alloca [2 x i64]
37 store ptr %var, ptr @var
45 declare ptr @callee2()
47 define ptr @caller2() ssp {
48 ; CHECK-LABEL: define ptr @caller2()
50 ; CHECK: @llvm.stackguard
52 ; CHECK: [[GUARD:%.*]] = call ptr @llvm.stackguard()
53 ; CHECK: [[TOKEN:%.*]] = load volatile ptr, ptr {{%.*}}
54 ; CHECK: [[TST:%.*]] = icmp eq ptr [[GUARD]], [[TOKEN]]
55 ; CHECK: br i1 [[TST]]
57 ; CHECK: [[TMP:%.*]] = musttail call ptr @callee2()
58 ; CHECK-NEXT: ret ptr [[TMP]]
60 %var = alloca [2 x i64]
61 store ptr %var, ptr @var
62 %tmp = musttail call ptr @callee2()
66 define void @caller3() ssp {
67 ; CHECK-LABEL: define void @caller3()
69 ; CHECK: @llvm.stackguard
71 ; CHECK: [[GUARD:%.*]] = call ptr @llvm.stackguard()
72 ; CHECK: [[TOKEN:%.*]] = load volatile ptr, ptr {{%.*}}
73 ; CHECK: [[TST:%.*]] = icmp eq ptr [[GUARD]], [[TOKEN]]
74 ; CHECK: br i1 [[TST]]
76 ; CHECK: tail call void @callee()
77 ; CHECK-NEXT: ret void
78 %var = alloca [2 x i64]
79 store ptr %var, ptr @var
80 tail call void @callee()
84 define ptr @caller4() ssp {
85 ; CHECK-LABEL: define ptr @caller4()
87 ; CHECK: @llvm.stackguard
89 ; CHECK: [[GUARD:%.*]] = call ptr @llvm.stackguard()
90 ; CHECK: [[TOKEN:%.*]] = load volatile ptr, ptr {{%.*}}
91 ; CHECK: [[TST:%.*]] = icmp eq ptr [[GUARD]], [[TOKEN]]
92 ; CHECK: br i1 [[TST]]
94 ; CHECK: [[TMP:%.*]] = tail call ptr @callee2()
95 ; CHECK-NEXT: ret ptr [[TMP]]
97 %var = alloca [2 x i64]
98 store ptr %var, ptr @var
99 %tmp = tail call ptr @callee2()