1; RUN: opt < %s -S -partial-inliner -skip-partial-inlining-cost-analysis=true | FileCheck %s 2 3; CHECK-LABEL: @callee 4; CHECK: %mul = mul nsw i32 %v, 10, !dbg ![[DBG1:[0-9]+]] 5define i32 @callee(i32 %v) !dbg !16 { 6entry: 7 %cmp = icmp sgt i32 %v, 2000 8 br i1 %cmp, label %if.then, label %if.end 9 10if.then: ; preds = %entry 11 %mul = mul nsw i32 %v, 10, !dbg !17 12 br label %if.then2 13 14if.then2: 15 %sub = sub i32 %v, 10, !dbg !23 16 br label %if.end 17 18if.end: ; preds = %if.then, %entry 19 %v2 = phi i32 [ %v, %entry ], [ %mul, %if.then2 ] 20 %add = add nsw i32 %v2, 200 21 ret i32 %add 22} 23 24; CHECK-LABEL: @caller 25; CHECK: codeRepl.i: 26; CHECK-NEXT: call void @callee.2.if.then(i32 %v, i32* %mul.loc.i), !dbg ![[DBG2:[0-9]+]] 27define i32 @caller(i32 %v) !dbg !8 { 28entry: 29 %call = call i32 @callee(i32 %v), !dbg !14 30 ret i32 %call 31} 32 33 34; CHECK-LABEL: @callee2 35; CHECK: %sub = sub i32 %v, 10, !dbg ![[DBG3:[0-9]+]] 36define i32 @callee2(i32 %v) !dbg !18 { 37entry: 38 %cmp = icmp sgt i32 %v, 2000 39 br i1 %cmp, label %if.then, label %if.end 40 41if.then: 42 br label %if.then2 43 44if.then2: 45 %sub = sub i32 %v, 10, !dbg !20 46 br label %if.end 47 48if.end: 49 %v2 = phi i32 [ %v, %entry ], [ %sub, %if.then2 ] 50 %add = add nsw i32 %v2, 200 51 ret i32 %add 52} 53 54; CHECK-LABEL: @caller2 55; CHECK: codeRepl.i: 56; CHECK-NEXT: call void @callee2.1.if.then(i32 %v, i32* %sub.loc.i), !dbg ![[DBG4:[0-9]+]] 57define i32 @caller2(i32 %v) !dbg !21 { 58entry: 59 %call = call i32 @callee2(i32 %v), !dbg !22 60 ret i32 %call 61} 62 63; CHECK-LABEL: define internal void @callee2.1.if.then 64; CHECK: br label %if.then, !dbg ![[DBG5:[0-9]+]] 65 66; CHECK-LABEL: define internal void @callee.2.if.then 67; CHECK: br label %if.then, !dbg ![[DBG6:[0-9]+]] 68 69; CHECK: ![[DBG1]] = !DILocation(line: 10, column: 7, 70; CHECK: ![[DBG2]] = !DILocation(line: 10, column: 7, 71; CHECK: ![[DBG3]] = !DILocation(line: 110, column: 17, 72; CHECK: ![[DBG4]] = !DILocation(line: 110, column: 17, 73; CHECK: ![[DBG5]] = !DILocation(line: 110, column: 17, 74; CHECK: ![[DBG6]] = !DILocation(line: 10, column: 7, 75 76 77!llvm.dbg.cu = !{!0} 78!llvm.module.flags = !{!3, !4, !5, !6} 79!llvm.ident = !{!7} 80 81!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0 (trunk 177881)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 82!1 = !DIFile(filename: "test.c", directory: "/tmp") 83!2 = !{} 84!3 = !{i32 2, !"Dwarf Version", i32 4} 85!4 = !{i32 2, !"Debug Info Version", i32 3} 86!5 = !{i32 1, !"wchar_size", i32 4} 87!6 = !{i32 1, !"min_enum_size", i32 4} 88!7 = !{!"clang version 6.0.0"} 89!8 = distinct !DISubprogram(name: "caller", scope: !1, file: !1, line: 3, type: !9, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !12) 90!9 = !DISubroutineType(types: !10) 91!10 = !{!11, !11} 92!11 = !DIBasicType(name: "int", size: 19, encoding: DW_ATE_signed) 93!12 = !{!13} 94!13 = !DILocalVariable(name: "v", arg: 1, scope: !8, file: !1, line: 3, type: !11) 95!14 = !DILocation(line: 5, column: 10, scope: !8) 96!15 = distinct !DILexicalBlock(scope: !16, file: !1, line: 9, column: 7) 97!16 = distinct !DISubprogram(name: "callee", scope: !1, file: !1, line: 8, type: !9, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !12) 98!17 = !DILocation(line: 10, column: 7, scope: !15) 99!18 = distinct !DISubprogram(name: "callee2", scope: !1, file: !1, line: 8, type: !9, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !12) 100!19 = distinct !DILexicalBlock(scope: !18, file: !1, line: 100, column: 1) 101!20 = !DILocation(line: 110, column: 17, scope: !19) 102!21 = distinct !DISubprogram(name: "caller2", scope: !1, file: !1, line: 8, type: !9, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !12) 103!22 = !DILocation(line: 110, column: 17, scope: !21) 104!23 = !DILocation(line: 15, column: 7, scope: !15) 105