llvm.org GIT mirror llvm / 8c9ed51
Emit discriminator for inlined callsites. Summary: Inlined callsites need to be emitted in debug info so that sample profile can be annotated to the correct inlined instance. Reviewers: dnovillo, dblaikie Subscribers: dblaikie, llvm-commits Differential Revision: http://reviews.llvm.org/D14511 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252768 91177308-0d34-0410-b5e6-96231b3b80d8 Dehao Chen 4 years ago
4 changed file(s) with 56 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
237237 DW_AT_GNU_addr_base = 0x2133,
238238 DW_AT_GNU_pubnames = 0x2134,
239239 DW_AT_GNU_pubtypes = 0x2135,
240 DW_AT_GNU_discriminator = 0x2136,
240241
241242 // LLVM project extensions.
242243 DW_AT_LLVM_include_path = 0x3e00,
438438 addUInt(*ScopeDIE, dwarf::DW_AT_call_file, None,
439439 getOrCreateSourceID(IA->getFilename(), IA->getDirectory()));
440440 addUInt(*ScopeDIE, dwarf::DW_AT_call_line, None, IA->getLine());
441 if (IA->getDiscriminator())
442 addUInt(*ScopeDIE, dwarf::DW_AT_GNU_discriminator, None, IA->getDiscriminator());
441443
442444 // Add name to the name table, we do this here because we're guaranteed
443445 // to have concrete versions of our DW_TAG_inlined_subprogram nodes.
200200 case DW_AT_GNU_addr_base: return "DW_AT_GNU_addr_base";
201201 case DW_AT_GNU_pubnames: return "DW_AT_GNU_pubnames";
202202 case DW_AT_GNU_pubtypes: return "DW_AT_GNU_pubtypes";
203 case DW_AT_GNU_discriminator: return "DW_AT_GNU_discriminator";
203204 }
204205 return nullptr;
205206 }
0 ; REQUIRES: object-emission
1
2 ; RUN: %llc_dwarf < %s -filetype=obj | llvm-dwarfdump -debug-dump=info - | FileCheck %s
3
4 ; Given the following source, ensure that the discriminator is emitted for
5 ; the inlined callsite.
6
7 ;void xyz();
8 ;static void __attribute__((always_inline)) bar() { xyz(); }
9 ;void foo() {
10 ; bar(); bar();
11 ;}
12
13 ;CHECK: DW_TAG_inlined_subroutine
14 ;CHECK-NOT: DW_AT_GNU_discriminator
15 ;CHECK: DW_TAG_inlined_subroutine
16 ;CHECK-NOT: {{DW_TAG|NULL}}
17 ;CHECK: DW_AT_GNU_discriminator{{.*}}0x01
18
19 ; Function Attrs: uwtable
20 define void @_Z3foov() #0 !dbg !4 {
21 tail call void @_Z3xyzv(), !dbg !11
22 tail call void @_Z3xyzv(), !dbg !13
23 ret void, !dbg !16
24 }
25
26 declare void @_Z3xyzv() #1
27
28 attributes #0 = { uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
29 attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
30
31 !llvm.dbg.cu = !{!0}
32 !llvm.module.flags = !{!8, !9}
33 !llvm.ident = !{!10}
34
35 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 252497)", isOptimized: true, runtimeVersion: 0, emissionKind: 1, enums: !2, subprograms: !3)
36 !1 = !DIFile(filename: "a.cc", directory: "/tmp")
37 !2 = !{}
38 !3 = !{!4, !7}
39 !4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !1, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, variables: !2)
40 !5 = !DISubroutineType(types: !6)
41 !6 = !{null}
42 !7 = distinct !DISubprogram(name: "bar", linkageName: "_ZL3barv", scope: !1, file: !1, line: 2, type: !5, isLocal: true, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, variables: !2)
43 !8 = !{i32 2, !"Dwarf Version", i32 4}
44 !9 = !{i32 2, !"Debug Info Version", i32 3}
45 !10 = !{!"clang version 3.8.0 (trunk 252497)"}
46 !11 = !DILocation(line: 2, column: 52, scope: !7, inlinedAt: !12)
47 !12 = distinct !DILocation(line: 4, column: 3, scope: !4)
48 !13 = !DILocation(line: 2, column: 52, scope: !7, inlinedAt: !14)
49 !14 = distinct !DILocation(line: 4, column: 10, scope: !15)
50 !15 = !DILexicalBlockFile(scope: !4, file: !1, discriminator: 1)
51 !16 = !DILocation(line: 5, column: 1, scope: !4)