139 lines · plain
1; RUN: opt -S -passes=partial-inliner -pass-remarks=partial-inlining -disable-output < %s 2>&1 | FileCheck %s2; RUN: opt -S -passes=partial-inliner -pass-remarks=partial-inlining -disable-output < %s 2>&1 | FileCheck %s3; RUN: opt -S -passes=partial-inliner -pass-remarks=partial-inlining -disable-output -max-partial-inlining=1 < %s 2>&1 | FileCheck %s4; RUN: opt -S -passes=partial-inliner -pass-remarks=partial-inlining -disable-output -max-partial-inlining=1 < %s 2>&1 | FileCheck %s5 6; RUN: opt -S -passes=partial-inliner -pass-remarks=partial-inlining -disable-partial-inlining < %s 2>&1 | FileCheck --check-prefix=LIMIT %s7; RUN: opt -S -passes=partial-inliner -pass-remarks=partial-inlining --disable-partial-inlining < %s 2>&1 | FileCheck --check-prefix=LIMIT %s8; RUN: opt -S -passes=partial-inliner -pass-remarks=partial-inlining -max-partial-inlining=0 < %s 2>&1 | FileCheck --check-prefix=LIMIT %s9; RUN: opt -S -passes=partial-inliner -pass-remarks=partial-inlining -max-partial-inlining=0 < %s 2>&1 | FileCheck --check-prefix=LIMIT %s10; RUN: opt -S -passes=partial-inliner -pass-remarks=partial-inlining -inline-threshold=0 < %s 2>&1 | FileCheck --check-prefix=LIMIT %s11; RUN: opt -S -passes=partial-inliner -pass-remarks=partial-inlining -inline-threshold=0 < %s 2>&1 | FileCheck --check-prefix=LIMIT %s12 13define i32 @bar(i32 %arg) local_unnamed_addr #0 !dbg !5 {14bb:15 %tmp = icmp slt i32 %arg, 0, !dbg !716 br i1 %tmp, label %bb1, label %bb2, !dbg !817 18bb1: ; preds = %bb19 tail call void (...) @foo() #0, !dbg !920 tail call void (...) @foo() #0, !dbg !1021 tail call void (...) @foo() #0, !dbg !1122 tail call void (...) @foo() #0, !dbg !1223 tail call void (...) @foo() #0, !dbg !1324 tail call void (...) @foo() #0, !dbg !1425 tail call void (...) @foo() #0, !dbg !1526 tail call void (...) @foo() #0, !dbg !1627 tail call void (...) @foo() #0, !dbg !1728 br label %bb2, !dbg !1829 30bb2: ; preds = %bb1, %bb31 %tmp3 = phi i32 [ 0, %bb1 ], [ 1, %bb ]32 ret i32 %tmp3, !dbg !1933}34 35define i32 @bar_noinline(i32 %arg) local_unnamed_addr #1 !dbg !23 {36bb:37 %tmp = icmp slt i32 %arg, 0, !dbg !2438 br i1 %tmp, label %bb1, label %bb2, !dbg !2439 40bb1: ; preds = %bb41 tail call void (...) @foo() #0, !dbg !2442 tail call void (...) @foo() #0, !dbg !2443 tail call void (...) @foo() #0, !dbg !2444 br label %bb2, !dbg !2445 46bb2: ; preds = %bb1, %bb47 %tmp3 = phi i32 [ 0, %bb1 ], [ 1, %bb ]48 ret i32 %tmp3, !dbg !2449}50 51define i32 @bar_alwaysinline(i32 %arg) local_unnamed_addr #2 !dbg !25 {52bb:53 %tmp = icmp slt i32 %arg, 0, !dbg !2654 br i1 %tmp, label %bb1, label %bb2, !dbg !2655 56bb1: ; preds = %bb57 tail call void (...) @foo() #0, !dbg !2658 tail call void (...) @foo() #0, !dbg !2659 tail call void (...) @foo() #0, !dbg !2660 br label %bb2, !dbg !2661 62bb2: ; preds = %bb1, %bb63 %tmp3 = phi i32 [ 0, %bb1 ], [ 1, %bb ]64 ret i32 %tmp3, !dbg !2665}66 67define i32 @bar_cold(i32 %arg) local_unnamed_addr #3 !dbg !27 {68bb:69 %tmp = icmp slt i32 %arg, 0, !dbg !2870 br i1 %tmp, label %bb1, label %bb2, !dbg !2871 72bb1: ; preds = %bb73 tail call void (...) @foo() #0, !dbg !2874 tail call void (...) @foo() #0, !dbg !2875 tail call void (...) @foo() #0, !dbg !2876 br label %bb2, !dbg !2877 78bb2: ; preds = %bb1, %bb79 %tmp3 = phi i32 [ 0, %bb1 ], [ 1, %bb ]80 ret i32 %tmp3, !dbg !2881}82 83; Function Attrs: nounwind84declare void @foo(...) local_unnamed_addr #085 86; Function Attrs: nounwind87define i32 @dummy_caller(i32 %arg) local_unnamed_addr #0 !dbg !20 {88bb:89; CHECK:remark{{.*}}bar partially inlined into dummy_caller90; CHECK-NOT:remark{{.*}}bar_noinline partially inlined into dummy_caller91; CHECK-NOT:remark{{.*}}bar_alwaysinline partially inlined into dummy_caller92; CHECK-NOT:remark{{.*}}bar_cold partially inlined into dummy_caller93; LIMIT-NOT:remark{{.*}}bar partially inlined into dummy_caller94 %tmp = tail call i32 @bar(i32 %arg), !dbg !2195 %tmp2 = tail call i32 @bar_noinline(i32 %arg), !dbg !2196 %tmp3 = tail call i32 @bar_alwaysinline(i32 %arg), !dbg !2197 %tmp4 = tail call i32 @bar_cold(i32 %arg), !dbg !2198 ret i32 %tmp, !dbg !2299}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