1 ; RUN: llc -mtriple=x86_64-linux-gnu -fast-isel %s -o - -start-before=stack-protector -stop-after=stack-protector | FileCheck %s
7 define void @caller1() sspreq {
8 ; CHECK-LABEL: define void @caller1()
10 ; CHECK: @llvm.stackprotector
12 ; CHECK: [[GUARD:%.*]] = load volatile ptr, ptr
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() sspreq {
26 ; CHECK-LABEL: define void @justret()
28 ; CHECK: @llvm.stackprotector
30 ; CHECK: [[GUARD:%.*]] = load volatile ptr, ptr
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() sspreq {
48 ; CHECK-LABEL: define ptr @caller2()
50 ; CHECK: @llvm.stackprotector
52 ; CHECK: [[GUARD:%.*]] = load volatile ptr, ptr
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() sspreq {
67 ; CHECK-LABEL: define void @caller3()
69 ; CHECK: @llvm.stackprotector
71 ; CHECK: [[GUARD:%.*]] = load volatile ptr, ptr
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() sspreq {
85 ; CHECK-LABEL: define ptr @caller4()
87 ; CHECK: @llvm.stackprotector
89 ; CHECK: [[GUARD:%.*]] = load volatile ptr, ptr
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()