107 lines · plain
1; RUN: opt < %s -S -passes=partial-inliner -skip-partial-inlining-cost-analysis=true | FileCheck %s2 3; CHECK-LABEL: @callee4; 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, 20008 br i1 %cmp, label %if.then, label %if.end9 10if.then: ; preds = %entry11 %mul = mul nsw i32 %v, 10, !dbg !1712 br label %if.then213 14if.then2:15 %sub = sub i32 %v, 10, !dbg !2316 br label %if.end17 18if.end: ; preds = %if.then, %entry19 %v2 = phi i32 [ %v, %entry ], [ %mul, %if.then2 ]20 %add = add nsw i32 %v2, 20021 ret i32 %add22}23 24; CHECK-LABEL: @caller25; CHECK: codeRepl.i:26; CHECK-NOT: br label27; CHECK: call void @callee.2.if.then(i32 %v, ptr %mul.loc.i), !dbg ![[DBG2:[0-9]+]]28define i32 @caller(i32 %v) !dbg !8 {29entry:30 %call = call i32 @callee(i32 %v), !dbg !1431 ret i32 %call32}33 34 35; CHECK-LABEL: @callee236; CHECK: %sub = sub i32 %v, 10, !dbg ![[DBG3:[0-9]+]]37define i32 @callee2(i32 %v) !dbg !18 {38entry:39 %cmp = icmp sgt i32 %v, 200040 br i1 %cmp, label %if.then, label %if.end41 42if.then:43 br label %if.then244 45if.then2:46 %sub = sub i32 %v, 10, !dbg !2047 br label %if.end48 49if.end:50 %v2 = phi i32 [ %v, %entry ], [ %sub, %if.then2 ]51 %add = add nsw i32 %v2, 20052 ret i32 %add53}54 55; CHECK-LABEL: @caller256; CHECK: codeRepl.i:57; CHECK-NOT: br label58; CHECK: call void @callee2.1.if.then(i32 %v, ptr %sub.loc.i), !dbg ![[DBG4:[0-9]+]]59define i32 @caller2(i32 %v) !dbg !21 {60entry:61 %call = call i32 @callee2(i32 %v), !dbg !2262 ret i32 %call63}64 65; CHECK-LABEL: define internal void @callee2.1.if.then66; CHECK: br label %if.then, !dbg ![[DBG5:[0-9]+]]67 68; CHECK-LABEL: define internal void @callee.2.if.then69; CHECK: br label %if.then, !dbg ![[DBG6:[0-9]+]]70 71; CHECK: ![[DBG1]] = !DILocation(line: 10, column: 7,72; CHECK: ![[DBG2]] = !DILocation(line: 10, column: 7,73; CHECK: ![[DBG3]] = !DILocation(line: 110, column: 17,74; CHECK: ![[DBG4]] = !DILocation(line: 110, column: 17,75; CHECK: ![[DBG5]] = !DILocation(line: 110, column: 17,76; CHECK: ![[DBG6]] = !DILocation(line: 10, column: 7,77 78 79!llvm.dbg.cu = !{!0}80!llvm.module.flags = !{!3, !4, !5, !6}81!llvm.ident = !{!7}82 83!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)84!1 = !DIFile(filename: "test.c", directory: "/tmp")85!2 = !{}86!3 = !{i32 2, !"Dwarf Version", i32 4}87!4 = !{i32 2, !"Debug Info Version", i32 3}88!5 = !{i32 1, !"wchar_size", i32 4}89!6 = !{i32 1, !"min_enum_size", i32 4}90!7 = !{!"clang version 6.0.0"}91!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)92!9 = !DISubroutineType(types: !10)93!10 = !{!11, !11}94!11 = !DIBasicType(name: "int", size: 19, encoding: DW_ATE_signed)95!12 = !{!13}96!13 = !DILocalVariable(name: "v", arg: 1, scope: !8, file: !1, line: 3, type: !11)97!14 = !DILocation(line: 5, column: 10, scope: !8)98!15 = distinct !DILexicalBlock(scope: !16, file: !1, line: 9, column: 7)99!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: !2)100!17 = !DILocation(line: 10, column: 7, scope: !15)101!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: !2)102!19 = distinct !DILexicalBlock(scope: !18, file: !1, line: 100, column: 1)103!20 = !DILocation(line: 110, column: 17, scope: !19)104!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: !2)105!22 = !DILocation(line: 110, column: 17, scope: !21)106!23 = !DILocation(line: 15, column: 7, scope: !15)107