• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -mtriple=x86_64-apple-darwin10 | FileCheck %s -check-prefix=X64
2; RUN: llc < %s -mtriple=x86_64-pc-win32 | FileCheck %s -check-prefix=WIN64
3
4@.str = private unnamed_addr constant [5 x i8] c"%ld\0A\00"
5@sel = external global i8*
6@sel3 = external global i8*
7@sel4 = external global i8*
8@sel5 = external global i8*
9@sel6 = external global i8*
10@sel7 = external global i8*
11
12; X64: @foo
13; X64: jmp
14; WIN64: @foo
15; WIN64: callq
16define void @foo(i64 %arg) nounwind optsize ssp noredzone {
17entry:
18  %call = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([5 x i8]* @.str, i64 0, i64 0), i64 %arg) nounwind optsize noredzone
19  ret void
20}
21
22declare i32 @printf(i8*, ...) optsize noredzone
23
24; X64: @bar
25; X64: jmp
26; WIN64: @bar
27; WIN64: jmp
28define void @bar(i64 %arg) nounwind optsize ssp noredzone {
29entry:
30  tail call void @bar2(i8* getelementptr inbounds ([5 x i8]* @.str, i64 0, i64 0), i64 %arg) nounwind optsize noredzone
31  ret void
32}
33
34declare void @bar2(i8*, i64) optsize noredzone
35
36; X64: @foo2
37; X64: jmp
38; WIN64: @foo2
39; WIN64: callq
40define i8* @foo2(i8* %arg) nounwind optsize ssp noredzone {
41entry:
42  %tmp1 = load i8** @sel, align 8, !tbaa !0
43  %call = tail call i8* (i8*, i8*, ...)* @x2(i8* %arg, i8* %tmp1) nounwind optsize noredzone
44  ret i8* %call
45}
46
47declare i8* @x2(i8*, i8*, ...) optsize noredzone
48
49; X64: @foo6
50; X64: jmp
51; WIN64: @foo6
52; WIN64: callq
53define i8* @foo6(i8* %arg1, i8* %arg2) nounwind optsize ssp noredzone {
54entry:
55  %tmp2 = load i8** @sel3, align 8, !tbaa !0
56  %tmp3 = load i8** @sel4, align 8, !tbaa !0
57  %tmp4 = load i8** @sel5, align 8, !tbaa !0
58  %tmp5 = load i8** @sel6, align 8, !tbaa !0
59  %call = tail call i8* (i8*, i8*, i8*, ...)* @x3(i8* %arg1, i8* %arg2, i8* %tmp2, i8* %tmp3, i8* %tmp4, i8* %tmp5) nounwind optsize noredzone
60  ret i8* %call
61}
62
63declare i8* @x3(i8*, i8*, i8*, ...) optsize noredzone
64
65; X64: @foo7
66; X64: callq
67; WIN64: @foo7
68; WIN64: callq
69define i8* @foo7(i8* %arg1, i8* %arg2) nounwind optsize ssp noredzone {
70entry:
71  %tmp2 = load i8** @sel3, align 8, !tbaa !0
72  %tmp3 = load i8** @sel4, align 8, !tbaa !0
73  %tmp4 = load i8** @sel5, align 8, !tbaa !0
74  %tmp5 = load i8** @sel6, align 8, !tbaa !0
75  %tmp6 = load i8** @sel7, align 8, !tbaa !0
76  %call = tail call i8* (i8*, i8*, i8*, i8*, i8*, i8*, i8*, ...)* @x7(i8* %arg1, i8* %arg2, i8* %tmp2, i8* %tmp3, i8* %tmp4, i8* %tmp5, i8* %tmp6) nounwind optsize noredzone
77  ret i8* %call
78}
79
80declare i8* @x7(i8*, i8*, i8*, i8*, i8*, i8*, i8*, ...) optsize noredzone
81
82; X64: @foo8
83; X64: callq
84; WIN64: @foo8
85; WIN64: callq
86define i8* @foo8(i8* %arg1, i8* %arg2) nounwind optsize ssp noredzone {
87entry:
88  %tmp2 = load i8** @sel3, align 8, !tbaa !0
89  %tmp3 = load i8** @sel4, align 8, !tbaa !0
90  %tmp4 = load i8** @sel5, align 8, !tbaa !0
91  %tmp5 = load i8** @sel6, align 8, !tbaa !0
92  %call = tail call i8* (i8*, i8*, i8*, ...)* @x3(i8* %arg1, i8* %arg2, i8* %tmp2, i8* %tmp3, i8* %tmp4, i8* %tmp5, i32 48879, i32 48879) nounwind optsize noredzone
93  ret i8* %call
94}
95
96!0 = metadata !{metadata !"any pointer", metadata !1}
97!1 = metadata !{metadata !"omnipotent char", metadata !2}
98!2 = metadata !{metadata !"Simple C/C++ TBAA", null}
99