llvm.org GIT mirror llvm / b45da9e
[InlineFunction] Set debug loc for call to forward varargs. Reviewers: aprantl, dblaikie, rnk Reviewed By: rnk Subscribers: eraman, llvm-commits, JDevlieghere Differential Revision: https://reviews.llvm.org/D40432 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320252 91177308-0d34-0410-b5e6-96231b3b80d8 Florian Hahn 1 year, 9 months ago
2 changed file(s) with 68 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
18651865 SmallVector Params(CI->arg_operands());
18661866 Params.append(VarArgsToForward.begin(), VarArgsToForward.end());
18671867 CallInst *Call = CallInst::Create(CI->getCalledFunction(), Params, "", CI);
1868 Call->setDebugLoc(CI->getDebugLoc());
18681869 CI->replaceAllUsesWith(Call);
18691870 CI->eraseFromParent();
18701871 }
0 ; RUN: opt < %s -S -partial-inliner -skip-partial-inlining-cost-analysis=true | FileCheck %s
1
2 ; CHECK-LABEL: @callee
3 ; CHECK: %mul = mul nsw i32 %v, 10, !dbg ![[DBG1:[0-9]+]]
4 define i32 @callee(i32 %v, ...) !dbg !16 {
5 entry:
6 %cmp = icmp sgt i32 %v, 2000, !dbg !17
7 br i1 %cmp, label %if.then, label %if.end, !dbg !19
8
9 if.then: ; preds = %entry
10 %mul = mul nsw i32 %v, 10, !dbg !20
11 br label %if.end, !dbg !21
12
13 if.end: ; preds = %if.then, %entry
14 %v2 = phi i32 [ %v, %entry ], [ %mul, %if.then ]
15 %add = add nsw i32 %v2, 200, !dbg !22
16 ret i32 %add, !dbg !23
17 }
18
19 ; CHECK-LABEL: @caller
20 ; CHECK: codeRepl.i:
21 ; CHECK-NEXT: call void (i32, i32*, ...) @callee.1_if.then(i32 %v, i32* %mul.loc.i, i32 99), !dbg ![[DBG2:[0-9]+]]
22 define i32 @caller(i32 %v) !dbg !8 {
23 entry:
24 %call = call i32 (i32, ...) @callee(i32 %v, i32 99), !dbg !14
25 ret i32 %call, !dbg !15
26 }
27
28 ; CHECK-LABEL: define internal void @callee.1_if.then
29 ; CHECK: br label %if.then, !dbg ![[DBG3:[0-9]+]]
30
31 ; CHECK: ![[DBG1]] = !DILocation(line: 10, column: 7,
32 ; CHECK: ![[DBG2]] = !DILocation(line: 10, column: 7,
33 ; CHECK: ![[DBG3]] = !DILocation(line: 10, column: 7,
34
35
36 !llvm.dbg.cu = !{!0}
37 !llvm.module.flags = !{!3, !4, !5, !6}
38 !llvm.ident = !{!7}
39
40 !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)
41 !1 = !DIFile(filename: "test.c", directory: "/tmp")
42 !2 = !{}
43 !3 = !{i32 2, !"Dwarf Version", i32 4}
44 !4 = !{i32 2, !"Debug Info Version", i32 3}
45 !5 = !{i32 1, !"wchar_size", i32 4}
46 !6 = !{i32 1, !"min_enum_size", i32 4}
47 !7 = !{!"clang version 6.0.0"}
48 !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, variables: !12)
49 !9 = !DISubroutineType(types: !10)
50 !10 = !{!11, !11}
51 !11 = !DIBasicType(name: "int", size: 19, encoding: DW_ATE_signed)
52 !12 = !{!13}
53 !13 = !DILocalVariable(name: "v", arg: 1, scope: !8, file: !1, line: 3, type: !11)
54 !14 = !DILocation(line: 5, column: 10, scope: !8)
55 !15 = !DILocation(line: 5, column: 3, scope: !8)
56 !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, variables: !26)
57 !26 = !{!27}
58 !27 = !DILocalVariable(name: "v", arg: 1, scope: !16, file: !1, line: 8, type: !11)
59 !17 = !DILocation(line: 9, column: 9, scope: !18)
60 !18 = distinct !DILexicalBlock(scope: !16, file: !1, line: 9, column: 7)
61 !19 = !DILocation(line: 9, column: 7, scope: !16)
62 !20 = !DILocation(line: 10, column: 7, scope: !18)
63 !21 = !DILocation(line: 10, column: 5, scope: !18)
64 !22 = !DILocation(line: 11, column: 5, scope: !16)
65 !36 = !DILocation(line: 12, column: 10, scope: !16)
66 !23 = !DILocation(line: 12, column: 3, scope: !16)