xref: /aosp_15_r20/external/llvm/test/DebugInfo/X86/pr11300.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=x86_64-apple-darwin %s -o %t -filetype=obj
2*9880d681SAndroid Build Coastguard Worker; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; test that the DW_AT_specification is a back edge in the file.
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker; Skip the definition of zed(foo*)
7*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_subprogram
8*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_class_type
9*9880d681SAndroid Build Coastguard Worker; CHECK:   DW_TAG_subprogram
10*9880d681SAndroid Build Coastguard Worker; CHECK:     DW_AT_linkage_name {{.*}} "_ZN3foo3barEv"
11*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_subprogram
12*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_TAG
13*9880d681SAndroid Build Coastguard Worker; CHECK:   DW_AT_specification {{.*}} "_ZN3foo3barEv"
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Worker%struct.foo = type { i8 }
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Workerdefine void @_Z3zedP3foo(%struct.foo* %x) uwtable !dbg !5 {
18*9880d681SAndroid Build Coastguard Workerentry:
19*9880d681SAndroid Build Coastguard Worker  %x.addr = alloca %struct.foo*, align 8
20*9880d681SAndroid Build Coastguard Worker  store %struct.foo* %x, %struct.foo** %x.addr, align 8
21*9880d681SAndroid Build Coastguard Worker  call void @llvm.dbg.declare(metadata %struct.foo** %x.addr, metadata !23, metadata !DIExpression()), !dbg !24
22*9880d681SAndroid Build Coastguard Worker  %0 = load %struct.foo*, %struct.foo** %x.addr, align 8, !dbg !25
23*9880d681SAndroid Build Coastguard Worker  call void @_ZN3foo3barEv(%struct.foo* %0), !dbg !25
24*9880d681SAndroid Build Coastguard Worker  ret void, !dbg !27
25*9880d681SAndroid Build Coastguard Worker}
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Workerdefine linkonce_odr void @_ZN3foo3barEv(%struct.foo* %this) nounwind uwtable align 2 !dbg !20 {
30*9880d681SAndroid Build Coastguard Workerentry:
31*9880d681SAndroid Build Coastguard Worker  %this.addr = alloca %struct.foo*, align 8
32*9880d681SAndroid Build Coastguard Worker  store %struct.foo* %this, %struct.foo** %this.addr, align 8
33*9880d681SAndroid Build Coastguard Worker  call void @llvm.dbg.declare(metadata %struct.foo** %this.addr, metadata !28, metadata !DIExpression()), !dbg !29
34*9880d681SAndroid Build Coastguard Worker  %this1 = load %struct.foo*, %struct.foo** %this.addr
35*9880d681SAndroid Build Coastguard Worker  ret void, !dbg !30
36*9880d681SAndroid Build Coastguard Worker}
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0}
39*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!33}
40*9880d681SAndroid Build Coastguard Worker
41*9880d681SAndroid Build Coastguard Worker!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.0 ()", isOptimized: false, emissionKind: FullDebug, file: !32, enums: !1, retainedTypes: !1, globals: !1, imports:  !1)
42*9880d681SAndroid Build Coastguard Worker!1 = !{}
43*9880d681SAndroid Build Coastguard Worker!5 = distinct !DISubprogram(name: "zed", linkageName: "_Z3zedP3foo", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 4, file: !6, scope: !6, type: !7)
44*9880d681SAndroid Build Coastguard Worker!6 = !DIFile(filename: "/home/espindola/llvm/test.cc", directory: "/home/espindola/tmpfs/build")
45*9880d681SAndroid Build Coastguard Worker!7 = !DISubroutineType(types: !8)
46*9880d681SAndroid Build Coastguard Worker!8 = !{null, !9}
47*9880d681SAndroid Build Coastguard Worker!9 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !10)
48*9880d681SAndroid Build Coastguard Worker!10 = !DICompositeType(tag: DW_TAG_class_type, name: "foo", line: 1, size: 8, align: 8, file: !32, elements: !11)
49*9880d681SAndroid Build Coastguard Worker!11 = !{!12}
50*9880d681SAndroid Build Coastguard Worker!12 = !DISubprogram(name: "bar", linkageName: "_ZN3foo3barEv", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !6, scope: !10, type: !13)
51*9880d681SAndroid Build Coastguard Worker!13 = !DISubroutineType(types: !14)
52*9880d681SAndroid Build Coastguard Worker!14 = !{null, !15}
53*9880d681SAndroid Build Coastguard Worker!15 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial, baseType: !10)
54*9880d681SAndroid Build Coastguard Worker!20 = distinct !DISubprogram(name: "bar", linkageName: "_ZN3foo3barEv", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 2, file: !6, scope: null, type: !13, declaration: !12)
55*9880d681SAndroid Build Coastguard Worker!23 = !DILocalVariable(name: "x", line: 4, arg: 1, scope: !5, file: !6, type: !9)
56*9880d681SAndroid Build Coastguard Worker!24 = !DILocation(line: 4, column: 15, scope: !5)
57*9880d681SAndroid Build Coastguard Worker!25 = !DILocation(line: 4, column: 20, scope: !26)
58*9880d681SAndroid Build Coastguard Worker!26 = distinct !DILexicalBlock(line: 4, column: 18, file: !6, scope: !5)
59*9880d681SAndroid Build Coastguard Worker!27 = !DILocation(line: 4, column: 30, scope: !26)
60*9880d681SAndroid Build Coastguard Worker!28 = !DILocalVariable(name: "this", line: 2, arg: 1, flags: DIFlagArtificial, scope: !20, file: !6, type: !15)
61*9880d681SAndroid Build Coastguard Worker!29 = !DILocation(line: 2, column: 8, scope: !20)
62*9880d681SAndroid Build Coastguard Worker!30 = !DILocation(line: 2, column: 15, scope: !31)
63*9880d681SAndroid Build Coastguard Worker!31 = distinct !DILexicalBlock(line: 2, column: 14, file: !6, scope: !20)
64*9880d681SAndroid Build Coastguard Worker!32 = !DIFile(filename: "/home/espindola/llvm/test.cc", directory: "/home/espindola/tmpfs/build")
65*9880d681SAndroid Build Coastguard Worker!33 = !{i32 1, !"Debug Info Version", i32 3}
66