xref: /llvm-project/llvm/test/Transforms/CodeExtractor/PartialInlineVarArgsDebug.ll (revision 0ca8ddd84d416b2b2b831fbc75ac8dbb77a12928)
1*0ca8ddd8SRoman Lebedev; RUN: opt < %s -S -passes=partial-inliner -skip-partial-inlining-cost-analysis=true | FileCheck %s
2cee313d2SEric Christopher
3cee313d2SEric Christopher; CHECK-LABEL: @callee
4cee313d2SEric Christopher; CHECK: %mul = mul nsw i32 %v, 10, !dbg ![[DBG1:[0-9]+]]
5cee313d2SEric Christopherdefine i32 @callee(i32 %v, ...) !dbg !16 {
6cee313d2SEric Christopherentry:
7cee313d2SEric Christopher  %cmp = icmp sgt i32 %v, 2000, !dbg !17
8cee313d2SEric Christopher  br i1 %cmp, label %if.then, label %if.end, !dbg !19
9cee313d2SEric Christopher
10cee313d2SEric Christopherif.then:                                          ; preds = %entry
11cee313d2SEric Christopher  %mul = mul nsw i32 %v, 10, !dbg !20
12cee313d2SEric Christopher  br label %if.end, !dbg !21
13cee313d2SEric Christopher
14cee313d2SEric Christopherif.end:                                           ; preds = %if.then, %entry
15cee313d2SEric Christopher  %v2 = phi i32 [ %v, %entry ], [ %mul, %if.then ]
16cee313d2SEric Christopher  %add = add nsw i32 %v2, 200, !dbg !22
17cee313d2SEric Christopher  ret i32 %add, !dbg !23
18cee313d2SEric Christopher}
19cee313d2SEric Christopher
20cee313d2SEric Christopher; CHECK-LABEL: @caller
21cee313d2SEric Christopher; CHECK: codeRepl.i:
22cee313d2SEric Christopher; CHECK-NOT: br label
2341d5033eSNikita Popov; CHECK: call void (i32, ptr, ...) @callee.1.if.then(i32 %v, ptr %mul.loc.i, i32 99), !dbg ![[DBG2:[0-9]+]]
24cee313d2SEric Christopherdefine i32 @caller(i32 %v) !dbg !8 {
25cee313d2SEric Christopherentry:
26cee313d2SEric Christopher  %call = call i32 (i32, ...) @callee(i32 %v, i32 99), !dbg !14
27cee313d2SEric Christopher  ret i32 %call, !dbg !15
28cee313d2SEric Christopher}
29cee313d2SEric Christopher
30cee313d2SEric Christopher; CHECK-LABEL: define internal void @callee.1.if.then
31cee313d2SEric Christopher; CHECK: br label %if.then, !dbg ![[DBG3:[0-9]+]]
32cee313d2SEric Christopher
33cee313d2SEric Christopher; CHECK: ![[DBG1]] = !DILocation(line: 10, column: 7,
34cee313d2SEric Christopher; CHECK: ![[DBG2]] = !DILocation(line: 10, column: 7,
35cee313d2SEric Christopher; CHECK: ![[DBG3]] = !DILocation(line: 10, column: 7,
36cee313d2SEric Christopher
37cee313d2SEric Christopher
38cee313d2SEric Christopher!llvm.dbg.cu = !{!0}
39cee313d2SEric Christopher!llvm.module.flags = !{!3, !4, !5, !6}
40cee313d2SEric Christopher!llvm.ident = !{!7}
41cee313d2SEric Christopher
42cee313d2SEric Christopher!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)
43cee313d2SEric Christopher!1 = !DIFile(filename: "test.c", directory: "/tmp")
44cee313d2SEric Christopher!2 = !{}
45cee313d2SEric Christopher!3 = !{i32 2, !"Dwarf Version", i32 4}
46cee313d2SEric Christopher!4 = !{i32 2, !"Debug Info Version", i32 3}
47cee313d2SEric Christopher!5 = !{i32 1, !"wchar_size", i32 4}
48cee313d2SEric Christopher!6 = !{i32 1, !"min_enum_size", i32 4}
49cee313d2SEric Christopher!7 = !{!"clang version 6.0.0"}
50cee313d2SEric Christopher!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)
51cee313d2SEric Christopher!9 = !DISubroutineType(types: !10)
52cee313d2SEric Christopher!10 = !{!11, !11}
53cee313d2SEric Christopher!11 = !DIBasicType(name: "int", size: 19, encoding: DW_ATE_signed)
54cee313d2SEric Christopher!12 = !{!13}
55cee313d2SEric Christopher!13 = !DILocalVariable(name: "v", arg: 1, scope: !8, file: !1, line: 3, type: !11)
56cee313d2SEric Christopher!14 = !DILocation(line: 5, column: 10, scope: !8)
57cee313d2SEric Christopher!15 = !DILocation(line: 5, column: 3, scope: !8)
58cee313d2SEric Christopher!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: !26)
59cee313d2SEric Christopher!26 = !{!27}
60cee313d2SEric Christopher!27 = !DILocalVariable(name: "v", arg: 1, scope: !16, file: !1, line: 8, type: !11)
61cee313d2SEric Christopher!17 = !DILocation(line: 9, column: 9, scope: !18)
62cee313d2SEric Christopher!18 = distinct !DILexicalBlock(scope: !16, file: !1, line: 9, column: 7)
63cee313d2SEric Christopher!19 = !DILocation(line: 9, column: 7, scope: !16)
64cee313d2SEric Christopher!20 = !DILocation(line: 10, column: 7, scope: !18)
65cee313d2SEric Christopher!21 = !DILocation(line: 10, column: 5, scope: !18)
66cee313d2SEric Christopher!22 = !DILocation(line: 11, column: 5, scope: !16)
67cee313d2SEric Christopher!36 = !DILocation(line: 12, column: 10, scope: !16)
68cee313d2SEric Christopher!23 = !DILocation(line: 12, column: 3, scope: !16)
69