1; RUN: opt -S -partial-inliner -pass-remarks=partial-inlining  -disable-output < %s 2>&1 | FileCheck %s
2; RUN: opt -S -passes=partial-inliner  -pass-remarks=partial-inlining -disable-output < %s 2>&1 | FileCheck %s
3; RUN: opt -S -partial-inliner -pass-remarks=partial-inlining  -disable-output -max-partial-inlining=1 < %s 2>&1 | FileCheck %s
4; RUN: opt -S -passes=partial-inliner  -pass-remarks=partial-inlining -disable-output -max-partial-inlining=1 < %s 2>&1 | FileCheck %s
5
6; RUN: opt -S -partial-inliner -pass-remarks=partial-inlining  -disable-partial-inlining < %s 2>&1 | FileCheck --check-prefix=LIMIT %s
7; RUN: opt -S -passes=partial-inliner  -pass-remarks=partial-inlining  --disable-partial-inlining < %s 2>&1 | FileCheck  --check-prefix=LIMIT %s
8; RUN: opt -S -partial-inliner -pass-remarks=partial-inlining   -max-partial-inlining=0 < %s 2>&1 | FileCheck --check-prefix=LIMIT  %s
9; RUN: opt -S -passes=partial-inliner  -pass-remarks=partial-inlining  -max-partial-inlining=0 < %s 2>&1 | FileCheck --check-prefix=LIMIT  %s
10
11define i32 @bar(i32 %arg) local_unnamed_addr #0 !dbg !5 {
12bb:
13  %tmp = icmp slt i32 %arg, 0, !dbg !7
14  br i1 %tmp, label %bb1, label %bb2, !dbg !8
15
16bb1:                                              ; preds = %bb
17  tail call void (...) @foo() #0, !dbg !9
18  tail call void (...) @foo() #0, !dbg !10
19  tail call void (...) @foo() #0, !dbg !11
20  tail call void (...) @foo() #0, !dbg !12
21  tail call void (...) @foo() #0, !dbg !13
22  tail call void (...) @foo() #0, !dbg !14
23  tail call void (...) @foo() #0, !dbg !15
24  tail call void (...) @foo() #0, !dbg !16
25  tail call void (...) @foo() #0, !dbg !17
26  br label %bb2, !dbg !18
27
28bb2:                                              ; preds = %bb1, %bb
29  %tmp3 = phi i32 [ 0, %bb1 ], [ 1, %bb ]
30  ret i32 %tmp3, !dbg !19
31}
32
33; Function Attrs: nounwind
34declare void @foo(...) local_unnamed_addr #0
35
36; Function Attrs: nounwind
37define i32 @dummy_caller(i32 %arg) local_unnamed_addr #0 !dbg !20 {
38bb:
39; CHECK:remark{{.*}}bar partially inlined into dummy_caller
40; LIMIT-NOT:remark{{.*}}bar partially inlined into dummy_caller
41  %tmp = tail call i32 @bar(i32 %arg), !dbg !21
42  ret i32 %tmp, !dbg !22
43}
44
45attributes #0 = { nounwind }
46
47!llvm.dbg.cu = !{!0}
48!llvm.module.flags = !{!3}
49!llvm.ident = !{!4}
50
51!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, enums: !2)
52!1 = !DIFile(filename: "t.c", directory: "/tmp")
53!2 = !{}
54!3 = !{i32 2, !"Debug Info Version", i32 3}
55!4 = !{!"clang "}
56!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, variables: !2)
57!6 = !DISubroutineType(types: !2)
58!7 = !DILocation(line: 4, column: 14, scope: !5)
59!8 = !DILocation(line: 4, column: 6, scope: !5)
60!9 = !DILocation(line: 5, column: 5, scope: !5)
61!10 = !DILocation(line: 6, column: 5, scope: !5)
62!11 = !DILocation(line: 7, column: 5, scope: !5)
63!12 = !DILocation(line: 8, column: 5, scope: !5)
64!13 = !DILocation(line: 9, column: 5, scope: !5)
65!14 = !DILocation(line: 10, column: 5, scope: !5)
66!15 = !DILocation(line: 11, column: 5, scope: !5)
67!16 = !DILocation(line: 12, column: 5, scope: !5)
68!17 = !DILocation(line: 13, column: 5, scope: !5)
69!18 = !DILocation(line: 14, column: 5, scope: !5)
70!19 = !DILocation(line: 17, column: 1, scope: !5)
71!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, variables: !2)
72!21 = !DILocation(line: 21, column: 11, scope: !20)
73!22 = !DILocation(line: 21, column: 4, scope: !20)
74