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