1 ; RUN: split-file %s %t
2 ; RUN: cat %t/main.ll %t/a.ll > %t/a2.ll
3 ; RUN: cat %t/main.ll %t/b.ll > %t/b2.ll
4 ; RUN: cat %t/main.ll %t/c.ll > %t/c2.ll
5 ; RUN: cat %t/main.ll %t/d.ll > %t/d2.ll
6 ; RUN: cat %t/main.ll %t/e.ll > %t/e2.ll
7 ; RUN: cat %t/main.ll %t/f.ll > %t/f2.ll
8 ; RUN: cat %t/main.ll %t/g.ll > %t/g2.ll
9 ; RUN: cat %t/main.ll %t/h.ll > %t/h2.ll
10 ; RUN: cat %t/existedGV.ll %t/main.ll %t/h.ll > %t/h3.ll
11 ; RUN: cat %t/main.ll %t/i.ll > %t/i2.ll
12 ; RUN: llc -mtriple=x86_64-pc-linux-gnu -o - < %t/a2.ll | FileCheck --check-prefix=CHECK-TLS-FS-40 %s
13 ; RUN: llc -mtriple=x86_64-pc-linux-gnu -o - < %t/b2.ll | FileCheck --check-prefix=CHECK-TLS-FS-40 %s
14 ; RUN: llc -mtriple=x86_64-pc-linux-gnu -o - < %t/c2.ll | FileCheck --check-prefix=CHECK-GLOBAL %s
15 ; RUN: llc -mtriple=x86_64-pc-linux-gnu -o - < %t/d2.ll | FileCheck --check-prefix=CHECK-TLS-FS-40 %s
16 ; RUN: llc -mtriple=x86_64-pc-linux-gnu -o - < %t/e2.ll | FileCheck --check-prefix=CHECK-GS %s
17 ; RUN: llc -mtriple=x86_64-pc-linux-gnu -o - < %t/f2.ll | FileCheck --check-prefix=CHECK-OFFSET %s
18 ; RUN: llc -mtriple=x86_64-pc-linux-gnu -o - < %t/g2.ll | FileCheck --check-prefix=CHECK-NEGATIVE-OFFSET %s
19 ; RUN: llc -mtriple=x86_64-pc-linux-gnu -o - < %t/h2.ll | FileCheck --check-prefix=CHECK-SYM %s
20 ; RUN: llc -mtriple=x86_64-pc-linux-gnu -o - < %t/h3.ll | FileCheck --check-prefix=CHECK-SYMGV %s
21 ; RUN: llc -mtriple=x86_64-pc-linux-gnu -o - < %t/i2.ll | FileCheck --check-prefix=CHECK-SYM2 %s
23 ; CHECK-TLS-FS-40: movq %fs:40, %rax
24 ; CHECK-TLS-FS-40: movq %fs:40, %rax
25 ; CHECK-TLS-FS-40-NEXT: cmpq 16(%rsp), %rax
26 ; CHECK-TLS-FS-40-NEXT: jne .LBB0_2
27 ; CHECK-TLS-FS-40: .LBB0_2:
28 ; CHECK-TLS-FS-40-NEXT: .cfi_def_cfa_offset 32
29 ; CHECK-TLS-FS-40-NEXT: callq __stack_chk_fail
31 ; CHECK-GS: movq %gs:40, %rax
32 ; CHECK-GS: movq %gs:40, %rax
33 ; CHECK-GS-NEXT: cmpq 16(%rsp), %rax
34 ; CHECK-GS-NEXT: jne .LBB0_2
36 ; CHECK-GS-NEXT: .cfi_def_cfa_offset 32
37 ; CHECK-GS-NEXT: callq __stack_chk_fail
39 ; CHECK-OFFSET: movq %fs:20, %rax
40 ; CHECK-OFFSET: movq %fs:20, %rax
41 ; CHECK-OFFSET-NEXT: cmpq 16(%rsp), %rax
42 ; CHECK-OFFSET-NEXT: jne .LBB0_2
43 ; CHECK-OFFSET: .LBB0_2:
44 ; CHECK-OFFSET-NEXT: .cfi_def_cfa_offset 32
45 ; CHECK-OFFSET-NEXT: callq __stack_chk_fail
47 ; CHECK-NEGATIVE-OFFSET: movl $4294967276, %eax # imm = 0xFFFFFFEC
48 ; CHECK-NEGATIVE-OFFSET: movq %fs:(%rax), %rcx
49 ; CHECK-NEGATIVE-OFFSET: movq %fs:(%rax), %rax
50 ; CHECK-NEGATIVE-OFFSET-NEXT: cmpq 16(%rsp), %rax
51 ; CHECK-NEGATIVE-OFFSET-NEXT: jne .LBB0_2
52 ; CHECK-NEGATIVE-OFFSET: .LBB0_2:
53 ; CHECK-NEGATIVE-OFFSET-NEXT: .cfi_def_cfa_offset 32
54 ; CHECK-NEGATIVE-OFFSET-NEXT: callq __stack_chk_fail
56 ; CHECK-GLOBAL: movq __stack_chk_guard(%rip), %rax
57 ; CHECK-GLOBAL: movq __stack_chk_guard(%rip), %rax
58 ; CHECK-GLOBAL-NEXT: cmpq 16(%rsp), %rax
59 ; CHECK-GLOBAL-NEXT: jne .LBB0_2
60 ; CHECK-GLOBAL: .LBB0_2:
61 ; CHECK-GLOBAL-NEXT: .cfi_def_cfa_offset 32
62 ; CHECK-GLOBAL-NEXT: callq __stack_chk_fail
64 ; CHECK-SYM: movq __woof@GOTPCREL(%rip), %rax
65 ; CHECK-SYM-NEXT: movq %fs:(%rax), %rcx
66 ; CHECK-SYM-NEXT: movq %rcx, 16(%rsp)
67 ; CHECK-SYM: movq %fs:(%rax), %rax
68 ; CHECK-SYM-NEXT: cmpq 16(%rsp), %rax
69 ; CHECK-SYM-NEXT: jne .LBB0_2
71 ; CHECK-SYM-NEXT: .cfi_def_cfa_offset 32
72 ; CHECK-SYM-NEXT: callq __stack_chk_fail
74 ; CHECK-SYMGV: movq __woof(%rip), %rax
75 ; CHECK-SYMGV-NEXT: movq %rax, 16(%rsp)
76 ; CHECK-SYMGV: cmpq 16(%rsp), %rax
77 ; CHECK-SYMGV-NEXT: jne .LBB0_2
78 ; CHECK-SYMGV: .LBB0_2:
79 ; CHECK-SYMGV-NEXT: .cfi_def_cfa_offset 32
80 ; CHECK-SYMGV-NEXT: callq __stack_chk_fail
82 ; CHECK-SYM2: movq %fs:__woof(%rip), %rax
83 ; CHECK-SYM2-NEXT: movq %rax, 16(%rsp)
84 ; CHECK-SYM2: movq %fs:__woof(%rip), %rax
85 ; CHECK-SYM2-NEXT: cmpq 16(%rsp), %rax
86 ; CHECK-SYM2-NEXT: jne .LBB0_2
87 ; CHECK-SYM2: .LBB0_2:
88 ; CHECK-SYM2-NEXT: .cfi_def_cfa_offset 32
89 ; CHECK-SYM2-NEXT: callq __stack_chk_fai
94 @__woof = dso_local local_unnamed_addr global ptr null, align 8
98 @.str = private unnamed_addr constant [14 x i8] c"stackoverflow\00", align 1
99 @a = dso_local local_unnamed_addr global ptr null, align 8
101 ; Function Attrs: nounwind sspreq uwtable writeonly
102 define dso_local i32 @main() local_unnamed_addr #0 {
104 %array = alloca [5 x i8], align 1
105 call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %array) #2
106 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 dereferenceable(14) %array, ptr nonnull align 1 dereferenceable(14) @.str, i64 14, i1 false) #2
107 store ptr %array, ptr @a, align 8
108 call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %array) #2
112 ; Function Attrs: argmemonly nounwind willreturn
113 declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
115 ; Function Attrs: argmemonly nounwind willreturn
116 declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
118 ; Function Attrs: argmemonly nounwind willreturn
119 declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1
121 attributes #0 = { nounwind sspreq uwtable writeonly "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" }
122 attributes #1 = { argmemonly nounwind willreturn }
123 attributes #2 = { nounwind }
127 !llvm.module.flags = !{!1}
128 !1 = !{i32 2, !"stack-protector-guard", !"tls"}
130 !llvm.module.flags = !{!0,!1}
131 !0 = !{i32 7, !"direct-access-external-data", i32 1}
132 !1 = !{i32 2, !"stack-protector-guard", !"global"}
134 !llvm.module.flags = !{!1}
135 !1 = !{i32 2, !"stack-protector-guard-reg", !"fs"}
137 !llvm.module.flags = !{!1}
138 !1 = !{i32 2, !"stack-protector-guard-reg", !"gs"}
140 !llvm.module.flags = !{!1}
141 !1 = !{i32 2, !"stack-protector-guard-offset", i32 20}
143 !llvm.module.flags = !{!1}
144 !1 = !{i32 2, !"stack-protector-guard-offset", i32 -20}
146 !llvm.module.flags = !{!0,!1}
147 !0 = !{i32 7, !"direct-access-external-data", i32 0}
148 !1 = !{i32 2, !"stack-protector-guard-symbol", !"__woof"}
150 !llvm.module.flags = !{!0,!1}
151 !0 = !{i32 7, !"direct-access-external-data", i32 1}
152 !1 = !{i32 2, !"stack-protector-guard-symbol", !"__woof"}