1; RUN: %llc_dwarf -O0 -filetype=obj -dwarf-linkage-names=Abstract < %s | llvm-dwarfdump -v -debug-info - > %t 2; RUN: FileCheck %s -check-prefix=ONENAME < %t 3; RUN: FileCheck %s -check-prefix=REF < %t 4; Verify tuning for SCE gets us Abstract only. 5; RUN: %llc_dwarf -O0 -filetype=obj -debugger-tune=sce < %s | llvm-dwarfdump -v -debug-info - > %t 6; RUN: FileCheck %s -check-prefix=ONENAME < %t 7; RUN: FileCheck %s -check-prefix=REF < %t 8 9; Verify that the only linkage-name present is the abstract origin of the 10; inlined subprogram. 11 12; IR generated from clang -O0 with: 13; void f1(); 14; __attribute__((always_inline)) void f2() { 15; f1(); 16; } 17; void f3() { 18; f2(); 19; } 20; 21; struct F4 { 22; __attribute__((always_inline)) void f5(); 23; }; 24; void F4::f5() { 25; f1(); 26; } 27; void f6() { 28; F4::f5(); 29; } 30 31; Show that the only linkage names are for the inlined functions, 32; because those are the ones with an abstract origin. 33; ONENAME-NOT: {{DW_AT(_MIPS)?_linkage_name}} 34; ONENAME: {{DW_AT(_MIPS)?_linkage_name}} {{.*}} "_Z2f2v" 35; ONENAME-NOT: {{DW_AT(_MIPS)?_linkage_name}} 36; ONENAME: {{DW_AT(_MIPS)?_linkage_name}} {{.*}} "_ZN2F42f5Ev" 37; ONENAME-NOT: {{DW_AT(_MIPS)?_linkage_name}} 38 39; For f2() we see the definition pointing to an abstract origin DIE, 40; which in turn is where the linkage_name is; and then there's 41; an inlined_subroutine pointing back to the abstract origin. 42; The order of these DIEs is not important of course, just the links. 43; REF: DW_TAG_subprogram 44; REF-NOT: {{DW_TAG|NULL}} 45; REF: DW_AT_abstract_origin {{.*}} {[[F2:0x.*]]} "_Z2f2v" 46; REF: [[F2]]: DW_TAG_subprogram 47; REF-NEXT: linkage_name {{.*}} "_Z2f2v" 48; REF: DW_TAG_inlined_subroutine 49; REF-NOT: {{DW_TAG|NULL}} 50; REF: DW_AT_abstract_origin {{.*}} {[[F2]]} 51 52; For F4::f5(), first we see the in-class declaration, 53; then the definition, abstract origin, and the inlined_subroutine. 54; REF: DW_TAG_structure_type 55; REF-NEXT: DW_AT_name {{.*}} "F4" 56; REF-NOT: {{DW_TAG|NULL}} 57; REF: [[F5_DECL:0x.*]]: DW_TAG_subprogram 58; REF-NEXT: DW_AT_name {{.*}} "f5" 59; REF: DW_TAG_subprogram 60; REF-NOT: {{DW_TAG|NULL}} 61; REF: DW_AT_abstract_origin {{.*}} {[[F5_ABS:0x.*]]} "_ZN2F42f5Ev" 62; REF: [[F5_ABS]]: DW_TAG_subprogram 63; REF-NOT: {{DW_TAG|NULL}} 64; REF: linkage_name {{.*}} "_ZN2F42f5Ev" 65; REF-NEXT: DW_AT_specification {{.*}} {[[F5_DECL]]} 66; REF: DW_TAG_inlined_subroutine 67; REF-NOT: {{DW_TAG|NULL}} 68; REF: DW_AT_abstract_origin {{.*}} {[[F5_ABS]]} 69 70 71; Function Attrs: alwaysinline uwtable 72define void @_Z2f2v() #0 !dbg !6 { 73entry: 74 call void @_Z2f1v(), !dbg !9 75 ret void, !dbg !10 76} 77 78declare void @_Z2f1v() 79 80; Function Attrs: uwtable 81define void @_Z2f3v() !dbg !11 { 82entry: 83 call void @_Z2f1v(), !dbg !12 84 ret void, !dbg !14 85} 86 87; Function Attrs: alwaysinline uwtable 88define void @_ZN2F42f5Ev() #0 align 2 !dbg !15 { 89entry: 90 call void @_Z2f1v(), !dbg !19 91 ret void, !dbg !20 92} 93 94; Function Attrs: uwtable 95define void @_Z2f6v() !dbg !21 { 96entry: 97 call void @_Z2f1v(), !dbg !22 98 ret void, !dbg !24 99} 100 101attributes #0 = { alwaysinline } 102 103!llvm.dbg.cu = !{!0} 104!llvm.module.flags = !{!3, !4} 105!llvm.ident = !{!5} 106 107!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 4.0.0 (trunk 288231)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 108!1 = !DIFile(filename: "linkage-name-abstract-static.cpp", directory: "/home/probinson/projects/scratch") 109!2 = !{} 110!3 = !{i32 2, !"Dwarf Version", i32 4} 111!4 = !{i32 2, !"Debug Info Version", i32 3} 112!5 = !{!"clang version 4.0.0 (trunk 288231)"} 113!6 = distinct !DISubprogram(name: "f2", linkageName: "_Z2f2v", scope: !1, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) 114!7 = !DISubroutineType(types: !8) 115!8 = !{null} 116!9 = !DILocation(line: 3, column: 3, scope: !6) 117!10 = !DILocation(line: 4, column: 1, scope: !6) 118!11 = distinct !DISubprogram(name: "f3", linkageName: "_Z2f3v", scope: !1, file: !1, line: 5, type: !7, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) 119!12 = !DILocation(line: 3, column: 3, scope: !6, inlinedAt: !13) 120!13 = distinct !DILocation(line: 6, column: 3, scope: !11) 121!14 = !DILocation(line: 7, column: 1, scope: !11) 122!15 = distinct !DISubprogram(name: "f5", linkageName: "_ZN2F42f5Ev", scope: !16, file: !1, line: 12, type: !7, isLocal: false, isDefinition: true, scopeLine: 12, flags: DIFlagPrototyped, isOptimized: false, unit: !0, declaration: !18, retainedNodes: !2) 123!16 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "F4", file: !1, line: 9, size: 8, elements: !17, identifier: "_ZTS2F4") 124!17 = !{!18} 125!18 = !DISubprogram(name: "f5", linkageName: "_ZN2F42f5Ev", scope: !16, file: !1, line: 10, type: !7, isLocal: false, isDefinition: false, scopeLine: 10, flags: DIFlagPrototyped, isOptimized: false) 126!19 = !DILocation(line: 13, column: 3, scope: !15) 127!20 = !DILocation(line: 14, column: 1, scope: !15) 128!21 = distinct !DISubprogram(name: "f6", linkageName: "_Z2f6v", scope: !1, file: !1, line: 15, type: !7, isLocal: false, isDefinition: true, scopeLine: 15, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) 129!22 = !DILocation(line: 13, column: 3, scope: !15, inlinedAt: !23) 130!23 = distinct !DILocation(line: 16, column: 3, scope: !21) 131!24 = !DILocation(line: 17, column: 1, scope: !21) 132