xref: /llvm-project/llvm/test/ThinLTO/X86/nossp.ll (revision 2bc57d85ebf244f19a3046295b58eb8c667f947d)
1; RUN: split-file %s %t
2; RUN: opt -module-summary %t/a.ll -o %ta.bc
3; RUN: opt -module-summary %t/b.ll -o %tb.bc
4; RUN: llvm-lto2 run %ta.bc %tb.bc -o %tc.bc -save-temps \
5; RUN:   -r=%ta.bc,nossp_caller,px \
6; RUN:   -r=%ta.bc,ssp_caller,px \
7; RUN:   -r=%ta.bc,nossp_caller2,px \
8; RUN:   -r=%ta.bc,ssp_caller2,px \
9; RUN:   -r=%ta.bc,nossp_callee,x \
10; RUN:   -r=%ta.bc,ssp_callee,x \
11; RUN:   -r=%tb.bc,nossp_callee,px \
12; RUN:   -r=%tb.bc,ssp_callee,px \
13; RUN:   -r=%tb.bc,foo
14; RUN: llvm-dis %tc.bc.1.4.opt.bc -o - | FileCheck %s
15
16;--- a.ll
17
18target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
19target triple = "x86_64-pc-linux-gnu"
20
21declare void @nossp_callee()
22declare void @ssp_callee() ssp
23
24; nossp caller should be able to inline nossp callee.
25define void @nossp_caller() {
26; CHECK-LABEL: define void @nossp_caller()
27; CHECK-NOT: #0
28; CHECK-NEXT: tail call void @foo
29  tail call void @nossp_callee()
30  ret void
31}
32
33; ssp caller should be able to inline ssp callee.
34define void @ssp_caller() ssp {
35; CHECK-LABEL: define void @ssp_caller()
36; CHECK-SAME: #0
37; CHECK-NEXT: tail call void @foo
38  tail call void @ssp_callee()
39  ret void
40}
41
42; nossp caller should be able to inline ssp callee.
43; the ssp attribute is not propagated.
44define void @nossp_caller2() {
45; CHECK-LABEL: define void @nossp_caller2()
46; CHECK-NOT: #0
47; CHECK-NEXT: tail call void @foo
48  tail call void @ssp_callee()
49  ret void
50}
51
52; ssp caller should be able to inline nossp callee.
53define void @ssp_caller2() ssp {
54; CHECK-LABEL: define void @ssp_caller2()
55; CHECK-SAME: #0
56; CHECK-NEXT: tail call void @foo
57  tail call void @nossp_callee()
58  ret void
59}
60
61; CHECK: attributes #0 = { ssp }
62
63;--- b.ll
64target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
65target triple = "x86_64-pc-linux-gnu"
66
67declare void @foo()
68
69define void @nossp_callee() {
70  call void @foo()
71  ret void
72}
73
74define void @ssp_callee() ssp {
75  call void @foo()
76  ret void
77}
78