xref: /aosp_15_r20/external/llvm/test/DebugInfo/Generic/linkage-name-abstract.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: %llc_dwarf -O0 -filetype=obj -dwarf-linkage-names=Abstract < %s | llvm-dwarfdump -debug-dump=info - > %t
2*9880d681SAndroid Build Coastguard Worker; RUN: FileCheck %s -check-prefix=ONENAME < %t
3*9880d681SAndroid Build Coastguard Worker; RUN: FileCheck %s -check-prefix=REF < %t
4*9880d681SAndroid Build Coastguard Worker; Verify tuning for SCE gets us Abstract only.
5*9880d681SAndroid Build Coastguard Worker; RUN: %llc_dwarf -O0 -filetype=obj -debugger-tune=sce < %s | llvm-dwarfdump -debug-dump=info - > %t
6*9880d681SAndroid Build Coastguard Worker; RUN: FileCheck %s -check-prefix=ONENAME < %t
7*9880d681SAndroid Build Coastguard Worker; RUN: FileCheck %s -check-prefix=REF < %t
8*9880d681SAndroid Build Coastguard Worker; REQUIRES: object-emission
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker; Verify that the only linkage-name present is the abstract origin of the
11*9880d681SAndroid Build Coastguard Worker; inlined subprogram.
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker; IR generated from clang -O0 with:
14*9880d681SAndroid Build Coastguard Worker; void f1();
15*9880d681SAndroid Build Coastguard Worker; __attribute__((always_inline)) void f2() {
16*9880d681SAndroid Build Coastguard Worker;   f1();
17*9880d681SAndroid Build Coastguard Worker; }
18*9880d681SAndroid Build Coastguard Worker; void f3() {
19*9880d681SAndroid Build Coastguard Worker;   f2();
20*9880d681SAndroid Build Coastguard Worker; }
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker; Show that there's only one linkage_name.
23*9880d681SAndroid Build Coastguard Worker; ONENAME:     {{DW_AT(_MIPS)?_linkage_name}}
24*9880d681SAndroid Build Coastguard Worker; ONENAME-NOT: {{DW_AT(_MIPS)?_linkage_name}}
25*9880d681SAndroid Build Coastguard Worker
26*9880d681SAndroid Build Coastguard Worker; Locate the subprogram DIE with the linkage name.
27*9880d681SAndroid Build Coastguard Worker; Show that the inlined_subroutine refers to it.
28*9880d681SAndroid Build Coastguard Worker; REF:     DW_TAG_subprogram
29*9880d681SAndroid Build Coastguard Worker; REF:     [[FOO:0x.*]]: DW_TAG_subprogram
30*9880d681SAndroid Build Coastguard Worker; REF-NOT: {{DW_TAG|NULL}}
31*9880d681SAndroid Build Coastguard Worker; REF:     {{DW_AT(_MIPS)?_linkage_name}}
32*9880d681SAndroid Build Coastguard Worker; REF:     DW_TAG_inlined_subroutine
33*9880d681SAndroid Build Coastguard Worker; REF-NOT: {{DW_TAG|NULL}}
34*9880d681SAndroid Build Coastguard Worker; REF:     DW_AT_abstract_origin {{.*}} {[[FOO]]}
35*9880d681SAndroid Build Coastguard Worker
36*9880d681SAndroid Build Coastguard Worker; Function Attrs: alwaysinline uwtable
37*9880d681SAndroid Build Coastguard Workerdefine void @_Z2f2v() #0 !dbg !4 {
38*9880d681SAndroid Build Coastguard Workerentry:
39*9880d681SAndroid Build Coastguard Worker  call void @_Z2f1v(), !dbg !11
40*9880d681SAndroid Build Coastguard Worker  ret void, !dbg !12
41*9880d681SAndroid Build Coastguard Worker}
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Workerdeclare void @_Z2f1v()
44*9880d681SAndroid Build Coastguard Worker
45*9880d681SAndroid Build Coastguard Worker; Function Attrs: uwtable
46*9880d681SAndroid Build Coastguard Workerdefine void @_Z2f3v() #2 !dbg !7 {
47*9880d681SAndroid Build Coastguard Workerentry:
48*9880d681SAndroid Build Coastguard Worker  call void @_Z2f1v(), !dbg !13
49*9880d681SAndroid Build Coastguard Worker  ret void, !dbg !15
50*9880d681SAndroid Build Coastguard Worker}
51*9880d681SAndroid Build Coastguard Worker
52*9880d681SAndroid Build Coastguard Workerattributes #0 = { alwaysinline uwtable }
53*9880d681SAndroid Build Coastguard Workerattributes #2 = { uwtable }
54*9880d681SAndroid Build Coastguard Worker
55*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0}
56*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!8, !9}
57*9880d681SAndroid Build Coastguard Worker!llvm.ident = !{!10}
58*9880d681SAndroid Build Coastguard Worker
59*9880d681SAndroid Build Coastguard Worker!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.9.0 (trunk 265282)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
60*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "linkage-name-abstract.cpp", directory: "/home/probinson/projects/scratch")
61*9880d681SAndroid Build Coastguard Worker!2 = !{}
62*9880d681SAndroid Build Coastguard Worker!4 = distinct !DISubprogram(name: "f2", linkageName: "_Z2f2v", scope: !1, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
63*9880d681SAndroid Build Coastguard Worker!5 = !DISubroutineType(types: !6)
64*9880d681SAndroid Build Coastguard Worker!6 = !{null}
65*9880d681SAndroid Build Coastguard Worker!7 = distinct !DISubprogram(name: "f3", linkageName: "_Z2f3v", scope: !1, file: !1, line: 5, type: !5, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
66*9880d681SAndroid Build Coastguard Worker!8 = !{i32 2, !"Dwarf Version", i32 4}
67*9880d681SAndroid Build Coastguard Worker!9 = !{i32 2, !"Debug Info Version", i32 3}
68*9880d681SAndroid Build Coastguard Worker!10 = !{!"clang version 3.9.0 (trunk 265282)"}
69*9880d681SAndroid Build Coastguard Worker!11 = !DILocation(line: 3, column: 3, scope: !4)
70*9880d681SAndroid Build Coastguard Worker!12 = !DILocation(line: 4, column: 1, scope: !4)
71*9880d681SAndroid Build Coastguard Worker!13 = !DILocation(line: 3, column: 3, scope: !4, inlinedAt: !14)
72*9880d681SAndroid Build Coastguard Worker!14 = distinct !DILocation(line: 6, column: 3, scope: !7)
73*9880d681SAndroid Build Coastguard Worker!15 = !DILocation(line: 7, column: 1, scope: !7)
74