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