1*cee313d2SEric Christopher; RUN: opt -S -partial-inliner -pass-remarks=partial-inlining  -disable-output < %s 2>&1 | FileCheck %s
2*cee313d2SEric Christopher; RUN: opt -S -passes=partial-inliner  -pass-remarks=partial-inlining -disable-output < %s 2>&1 | FileCheck %s
3*cee313d2SEric Christopher; RUN: opt -S -partial-inliner -pass-remarks=partial-inlining  -disable-output -max-partial-inlining=1 < %s 2>&1 | FileCheck %s
4*cee313d2SEric Christopher; RUN: opt -S -passes=partial-inliner  -pass-remarks=partial-inlining -disable-output -max-partial-inlining=1 < %s 2>&1 | FileCheck %s
5*cee313d2SEric Christopher
6*cee313d2SEric Christopher; RUN: opt -S -partial-inliner -pass-remarks=partial-inlining  -disable-partial-inlining < %s 2>&1 | FileCheck --check-prefix=LIMIT %s
7*cee313d2SEric Christopher; RUN: opt -S -passes=partial-inliner  -pass-remarks=partial-inlining  --disable-partial-inlining < %s 2>&1 | FileCheck  --check-prefix=LIMIT %s
8*cee313d2SEric Christopher; RUN: opt -S -partial-inliner -pass-remarks=partial-inlining   -max-partial-inlining=0 < %s 2>&1 | FileCheck --check-prefix=LIMIT  %s
9*cee313d2SEric Christopher; RUN: opt -S -passes=partial-inliner  -pass-remarks=partial-inlining  -max-partial-inlining=0 < %s 2>&1 | FileCheck --check-prefix=LIMIT  %s
10*cee313d2SEric Christopher; RUN: opt -S -partial-inliner -pass-remarks=partial-inlining   -inline-threshold=0 < %s 2>&1 | FileCheck --check-prefix=LIMIT  %s
11*cee313d2SEric Christopher; RUN: opt -S -passes=partial-inliner  -pass-remarks=partial-inlining  -inline-threshold=0 < %s 2>&1 | FileCheck --check-prefix=LIMIT  %s
12*cee313d2SEric Christopher
13*cee313d2SEric Christopherdefine i32 @bar(i32 %arg) local_unnamed_addr #0 !dbg !5 {
14*cee313d2SEric Christopherbb:
15*cee313d2SEric Christopher  %tmp = icmp slt i32 %arg, 0, !dbg !7
16*cee313d2SEric Christopher  br i1 %tmp, label %bb1, label %bb2, !dbg !8
17*cee313d2SEric Christopher
18*cee313d2SEric Christopherbb1:                                              ; preds = %bb
19*cee313d2SEric Christopher  tail call void (...) @foo() #0, !dbg !9
20*cee313d2SEric Christopher  tail call void (...) @foo() #0, !dbg !10
21*cee313d2SEric Christopher  tail call void (...) @foo() #0, !dbg !11
22*cee313d2SEric Christopher  tail call void (...) @foo() #0, !dbg !12
23*cee313d2SEric Christopher  tail call void (...) @foo() #0, !dbg !13
24*cee313d2SEric Christopher  tail call void (...) @foo() #0, !dbg !14
25*cee313d2SEric Christopher  tail call void (...) @foo() #0, !dbg !15
26*cee313d2SEric Christopher  tail call void (...) @foo() #0, !dbg !16
27*cee313d2SEric Christopher  tail call void (...) @foo() #0, !dbg !17
28*cee313d2SEric Christopher  br label %bb2, !dbg !18
29*cee313d2SEric Christopher
30*cee313d2SEric Christopherbb2:                                              ; preds = %bb1, %bb
31*cee313d2SEric Christopher  %tmp3 = phi i32 [ 0, %bb1 ], [ 1, %bb ]
32*cee313d2SEric Christopher  ret i32 %tmp3, !dbg !19
33*cee313d2SEric Christopher}
34*cee313d2SEric Christopher
35*cee313d2SEric Christopherdefine i32 @bar_noinline(i32 %arg) local_unnamed_addr #1 !dbg !23 {
36*cee313d2SEric Christopherbb:
37*cee313d2SEric Christopher  %tmp = icmp slt i32 %arg, 0, !dbg !24
38*cee313d2SEric Christopher  br i1 %tmp, label %bb1, label %bb2, !dbg !24
39*cee313d2SEric Christopher
40*cee313d2SEric Christopherbb1:                                              ; preds = %bb
41*cee313d2SEric Christopher  tail call void (...) @foo() #0, !dbg !24
42*cee313d2SEric Christopher  tail call void (...) @foo() #0, !dbg !24
43*cee313d2SEric Christopher  tail call void (...) @foo() #0, !dbg !24
44*cee313d2SEric Christopher  br label %bb2, !dbg !24
45*cee313d2SEric Christopher
46*cee313d2SEric Christopherbb2:                                              ; preds = %bb1, %bb
47*cee313d2SEric Christopher  %tmp3 = phi i32 [ 0, %bb1 ], [ 1, %bb ]
48*cee313d2SEric Christopher  ret i32 %tmp3, !dbg !24
49*cee313d2SEric Christopher}
50*cee313d2SEric Christopher
51*cee313d2SEric Christopherdefine i32 @bar_alwaysinline(i32 %arg) local_unnamed_addr #2 !dbg !25 {
52*cee313d2SEric Christopherbb:
53*cee313d2SEric Christopher  %tmp = icmp slt i32 %arg, 0, !dbg !26
54*cee313d2SEric Christopher  br i1 %tmp, label %bb1, label %bb2, !dbg !26
55*cee313d2SEric Christopher
56*cee313d2SEric Christopherbb1:                                              ; preds = %bb
57*cee313d2SEric Christopher  tail call void (...) @foo() #0, !dbg !26
58*cee313d2SEric Christopher  tail call void (...) @foo() #0, !dbg !26
59*cee313d2SEric Christopher  tail call void (...) @foo() #0, !dbg !26
60*cee313d2SEric Christopher  br label %bb2, !dbg !26
61*cee313d2SEric Christopher
62*cee313d2SEric Christopherbb2:                                              ; preds = %bb1, %bb
63*cee313d2SEric Christopher  %tmp3 = phi i32 [ 0, %bb1 ], [ 1, %bb ]
64*cee313d2SEric Christopher  ret i32 %tmp3, !dbg !26
65*cee313d2SEric Christopher}
66*cee313d2SEric Christopher
67*cee313d2SEric Christopherdefine i32 @bar_cold(i32 %arg) local_unnamed_addr #3 !dbg !27 {
68*cee313d2SEric Christopherbb:
69*cee313d2SEric Christopher  %tmp = icmp slt i32 %arg, 0, !dbg !28
70*cee313d2SEric Christopher  br i1 %tmp, label %bb1, label %bb2, !dbg !28
71*cee313d2SEric Christopher
72*cee313d2SEric Christopherbb1:                                              ; preds = %bb
73*cee313d2SEric Christopher  tail call void (...) @foo() #0, !dbg !28
74*cee313d2SEric Christopher  tail call void (...) @foo() #0, !dbg !28
75*cee313d2SEric Christopher  tail call void (...) @foo() #0, !dbg !28
76*cee313d2SEric Christopher  br label %bb2, !dbg !28
77*cee313d2SEric Christopher
78*cee313d2SEric Christopherbb2:                                              ; preds = %bb1, %bb
79*cee313d2SEric Christopher  %tmp3 = phi i32 [ 0, %bb1 ], [ 1, %bb ]
80*cee313d2SEric Christopher  ret i32 %tmp3, !dbg !28
81*cee313d2SEric Christopher}
82*cee313d2SEric Christopher
83*cee313d2SEric Christopher; Function Attrs: nounwind
84*cee313d2SEric Christopherdeclare void @foo(...) local_unnamed_addr #0
85*cee313d2SEric Christopher
86*cee313d2SEric Christopher; Function Attrs: nounwind
87*cee313d2SEric Christopherdefine i32 @dummy_caller(i32 %arg) local_unnamed_addr #0 !dbg !20 {
88*cee313d2SEric Christopherbb:
89*cee313d2SEric Christopher; CHECK:remark{{.*}}bar partially inlined into dummy_caller
90*cee313d2SEric Christopher; CHECK-NOT:remark{{.*}}bar_noinline partially inlined into dummy_caller
91*cee313d2SEric Christopher; CHECK-NOT:remark{{.*}}bar_alwaysinline partially inlined into dummy_caller
92*cee313d2SEric Christopher; CHECK-NOT:remark{{.*}}bar_cold partially inlined into dummy_caller
93*cee313d2SEric Christopher; LIMIT-NOT:remark{{.*}}bar partially inlined into dummy_caller
94*cee313d2SEric Christopher  %tmp = tail call i32 @bar(i32 %arg), !dbg !21
95*cee313d2SEric Christopher  %tmp2 = tail call i32 @bar_noinline(i32 %arg), !dbg !21
96*cee313d2SEric Christopher  %tmp3 = tail call i32 @bar_alwaysinline(i32 %arg), !dbg !21
97*cee313d2SEric Christopher  %tmp4 = tail call i32 @bar_cold(i32 %arg), !dbg !21
98*cee313d2SEric Christopher  ret i32 %tmp, !dbg !22
99*cee313d2SEric Christopher}
100*cee313d2SEric Christopher
101*cee313d2SEric Christopherattributes #0 = { nounwind }
102*cee313d2SEric Christopherattributes #1 = { noinline nounwind }
103*cee313d2SEric Christopherattributes #2 = { alwaysinline nounwind }
104*cee313d2SEric Christopherattributes #3 = { cold nounwind }
105*cee313d2SEric Christopher
106*cee313d2SEric Christopher!llvm.dbg.cu = !{!0}
107*cee313d2SEric Christopher!llvm.module.flags = !{!3}
108*cee313d2SEric Christopher!llvm.ident = !{!4}
109*cee313d2SEric Christopher
110*cee313d2SEric Christopher!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, enums: !2)
111*cee313d2SEric Christopher!1 = !DIFile(filename: "t.c", directory: "/tmp")
112*cee313d2SEric Christopher!2 = !{}
113*cee313d2SEric Christopher!3 = !{i32 2, !"Debug Info Version", i32 3}
114*cee313d2SEric Christopher!4 = !{!"clang "}
115*cee313d2SEric Christopher!5 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 3, type: !6, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !2)
116*cee313d2SEric Christopher!6 = !DISubroutineType(types: !2)
117*cee313d2SEric Christopher!7 = !DILocation(line: 4, column: 14, scope: !5)
118*cee313d2SEric Christopher!8 = !DILocation(line: 4, column: 6, scope: !5)
119*cee313d2SEric Christopher!9 = !DILocation(line: 5, column: 5, scope: !5)
120*cee313d2SEric Christopher!10 = !DILocation(line: 6, column: 5, scope: !5)
121*cee313d2SEric Christopher!11 = !DILocation(line: 7, column: 5, scope: !5)
122*cee313d2SEric Christopher!12 = !DILocation(line: 8, column: 5, scope: !5)
123*cee313d2SEric Christopher!13 = !DILocation(line: 9, column: 5, scope: !5)
124*cee313d2SEric Christopher!14 = !DILocation(line: 10, column: 5, scope: !5)
125*cee313d2SEric Christopher!15 = !DILocation(line: 11, column: 5, scope: !5)
126*cee313d2SEric Christopher!16 = !DILocation(line: 12, column: 5, scope: !5)
127*cee313d2SEric Christopher!17 = !DILocation(line: 13, column: 5, scope: !5)
128*cee313d2SEric Christopher!18 = !DILocation(line: 14, column: 5, scope: !5)
129*cee313d2SEric Christopher!19 = !DILocation(line: 17, column: 1, scope: !5)
130*cee313d2SEric Christopher!20 = distinct !DISubprogram(name: "dummy_caller", scope: !1, file: !1, line: 19, type: !6, isLocal: false, isDefinition: true, scopeLine: 19, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !2)
131*cee313d2SEric Christopher!21 = !DILocation(line: 21, column: 11, scope: !20)
132*cee313d2SEric Christopher!22 = !DILocation(line: 21, column: 4, scope: !20)
133*cee313d2SEric Christopher!23 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 3, type: !6, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !2)
134*cee313d2SEric Christopher!24 = !DILocation(line: 4, column: 6, scope: !23)
135*cee313d2SEric Christopher!25 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 3, type: !6, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !2)
136*cee313d2SEric Christopher!26 = !DILocation(line: 4, column: 6, scope: !25)
137*cee313d2SEric Christopher!27 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 3, type: !6, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !2)
138*cee313d2SEric Christopher!28 = !DILocation(line: 4, column: 6, scope: !27)
139