xref: /aosp_15_r20/external/llvm/test/DebugInfo/Generic/PR20038.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; REQUIRES: object-emission
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; For some reason, the output when targetting sparc is not quite as expected.
4*9880d681SAndroid Build Coastguard Worker; XFAIL: sparc
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker; RUN: %llc_dwarf -O0 -filetype=obj -dwarf-linkage-names=All < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker; IR generated from clang -O0 with:
9*9880d681SAndroid Build Coastguard Worker; struct C {
10*9880d681SAndroid Build Coastguard Worker;   ~C();
11*9880d681SAndroid Build Coastguard Worker; };
12*9880d681SAndroid Build Coastguard Worker; extern bool b;
13*9880d681SAndroid Build Coastguard Worker; void fun4() { b && (C(), 1); }
14*9880d681SAndroid Build Coastguard Worker; __attribute__((always_inline)) C::~C() { }
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_structure_type
17*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_TAG
18*9880d681SAndroid Build Coastguard Worker; CHECK:   DW_AT_name {{.*}} "C"
19*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: {{DW_TAG|NULL}}
20*9880d681SAndroid Build Coastguard Worker; CHECK:   DW_TAG_subprogram
21*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_TAG
22*9880d681SAndroid Build Coastguard Worker; CHECK:     DW_AT_name {{.*}} "~C"
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Worker; CHECK:  DW_TAG_subprogram
25*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_TAG
26*9880d681SAndroid Build Coastguard Worker; CHECK:   DW_AT_linkage_name {{.*}} "_ZN1CD1Ev"
27*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: {{DW_TAG|NULL}}
28*9880d681SAndroid Build Coastguard Worker; CHECK:  DW_TAG_formal_parameter
29*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_TAG
30*9880d681SAndroid Build Coastguard Worker; CHECK:     DW_AT_name {{.*}} "this"
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_subprogram
33*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_TAG
34*9880d681SAndroid Build Coastguard Worker; CHECK:   DW_AT_name {{.*}} "fun4"
35*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: {{DW_TAG|NULL}}
36*9880d681SAndroid Build Coastguard Worker; CHECK:   DW_TAG_inlined_subroutine
37*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_TAG
38*9880d681SAndroid Build Coastguard Worker; CHECK:     DW_AT_abstract_origin {{.*}} "_ZN1CD1Ev"
39*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: {{DW_TAG|NULL}}
40*9880d681SAndroid Build Coastguard Worker; CHECK:     DW_TAG_formal_parameter
41*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_TAG
42*9880d681SAndroid Build Coastguard Worker; CHECK:       DW_AT_abstract_origin {{.*}} "this"
43*9880d681SAndroid Build Coastguard Worker
44*9880d681SAndroid Build Coastguard Worker; FIXME: D2 is actually inlined into D1 but doesn't show up here, possibly due
45*9880d681SAndroid Build Coastguard Worker; to there being no work in D2 (calling another member function from the dtor
46*9880d681SAndroid Build Coastguard Worker; causes D2 to show up, calling a free function doesn't).
47*9880d681SAndroid Build Coastguard Worker
48*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_TAG
49*9880d681SAndroid Build Coastguard Worker; CHECK:     NULL
50*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_TAG
51*9880d681SAndroid Build Coastguard Worker; CHECK:   NULL
52*9880d681SAndroid Build Coastguard Worker
53*9880d681SAndroid Build Coastguard Worker%struct.C = type { i8 }
54*9880d681SAndroid Build Coastguard Worker
55*9880d681SAndroid Build Coastguard Worker@b = external global i8
56*9880d681SAndroid Build Coastguard Worker
57*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind
58*9880d681SAndroid Build Coastguard Workerdefine void @_Z4fun4v() #0 !dbg !12 {
59*9880d681SAndroid Build Coastguard Workerentry:
60*9880d681SAndroid Build Coastguard Worker  %this.addr.i.i = alloca %struct.C*, align 8, !dbg !21
61*9880d681SAndroid Build Coastguard Worker  %this.addr.i = alloca %struct.C*, align 8, !dbg !22
62*9880d681SAndroid Build Coastguard Worker  %agg.tmp.ensured = alloca %struct.C, align 1
63*9880d681SAndroid Build Coastguard Worker  %cleanup.cond = alloca i1
64*9880d681SAndroid Build Coastguard Worker  %0 = load i8, i8* @b, align 1, !dbg !24
65*9880d681SAndroid Build Coastguard Worker  %tobool = trunc i8 %0 to i1, !dbg !24
66*9880d681SAndroid Build Coastguard Worker  store i1 false, i1* %cleanup.cond
67*9880d681SAndroid Build Coastguard Worker  br i1 %tobool, label %land.rhs, label %land.end, !dbg !24
68*9880d681SAndroid Build Coastguard Worker
69*9880d681SAndroid Build Coastguard Workerland.rhs:                                         ; preds = %entry
70*9880d681SAndroid Build Coastguard Worker  store i1 true, i1* %cleanup.cond, !dbg !25
71*9880d681SAndroid Build Coastguard Worker  br label %land.end
72*9880d681SAndroid Build Coastguard Worker
73*9880d681SAndroid Build Coastguard Workerland.end:                                         ; preds = %land.rhs, %entry
74*9880d681SAndroid Build Coastguard Worker  %1 = phi i1 [ false, %entry ], [ true, %land.rhs ]
75*9880d681SAndroid Build Coastguard Worker  %cleanup.is_active = load i1, i1* %cleanup.cond, !dbg !27
76*9880d681SAndroid Build Coastguard Worker  br i1 %cleanup.is_active, label %cleanup.action, label %cleanup.done, !dbg !27
77*9880d681SAndroid Build Coastguard Worker
78*9880d681SAndroid Build Coastguard Workercleanup.action:                                   ; preds = %land.end
79*9880d681SAndroid Build Coastguard Worker  store %struct.C* %agg.tmp.ensured, %struct.C** %this.addr.i, align 8, !dbg !22
80*9880d681SAndroid Build Coastguard Worker  call void @llvm.dbg.declare(metadata %struct.C** %this.addr.i, metadata !129, metadata !DIExpression()), !dbg !31
81*9880d681SAndroid Build Coastguard Worker  %this1.i = load %struct.C*, %struct.C** %this.addr.i, !dbg !22
82*9880d681SAndroid Build Coastguard Worker  store %struct.C* %this1.i, %struct.C** %this.addr.i.i, align 8, !dbg !21
83*9880d681SAndroid Build Coastguard Worker  call void @llvm.dbg.declare(metadata %struct.C** %this.addr.i.i, metadata !132, metadata !DIExpression()), !dbg !33
84*9880d681SAndroid Build Coastguard Worker  %this1.i.i = load %struct.C*, %struct.C** %this.addr.i.i, !dbg !21
85*9880d681SAndroid Build Coastguard Worker  br label %cleanup.done, !dbg !22
86*9880d681SAndroid Build Coastguard Worker
87*9880d681SAndroid Build Coastguard Workercleanup.done:                                     ; preds = %cleanup.action, %land.end
88*9880d681SAndroid Build Coastguard Worker  ret void, !dbg !34
89*9880d681SAndroid Build Coastguard Worker}
90*9880d681SAndroid Build Coastguard Worker
91*9880d681SAndroid Build Coastguard Worker; Function Attrs: alwaysinline nounwind
92*9880d681SAndroid Build Coastguard Workerdefine void @_ZN1CD1Ev(%struct.C* %this) unnamed_addr #1 align 2 !dbg !17 {
93*9880d681SAndroid Build Coastguard Workerentry:
94*9880d681SAndroid Build Coastguard Worker  %this.addr.i = alloca %struct.C*, align 8, !dbg !37
95*9880d681SAndroid Build Coastguard Worker  %this.addr = alloca %struct.C*, align 8
96*9880d681SAndroid Build Coastguard Worker  store %struct.C* %this, %struct.C** %this.addr, align 8
97*9880d681SAndroid Build Coastguard Worker  call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !29, metadata !DIExpression()), !dbg !38
98*9880d681SAndroid Build Coastguard Worker  %this1 = load %struct.C*, %struct.C** %this.addr
99*9880d681SAndroid Build Coastguard Worker  store %struct.C* %this1, %struct.C** %this.addr.i, align 8, !dbg !37
100*9880d681SAndroid Build Coastguard Worker  call void @llvm.dbg.declare(metadata %struct.C** %this.addr.i, metadata !232, metadata !DIExpression()), !dbg !39
101*9880d681SAndroid Build Coastguard Worker  %this1.i = load %struct.C*, %struct.C** %this.addr.i, !dbg !37
102*9880d681SAndroid Build Coastguard Worker  ret void, !dbg !37
103*9880d681SAndroid Build Coastguard Worker}
104*9880d681SAndroid Build Coastguard Worker
105*9880d681SAndroid Build Coastguard Worker; Function Attrs: alwaysinline nounwind
106*9880d681SAndroid Build Coastguard Workerdefine void @_ZN1CD2Ev(%struct.C* %this) unnamed_addr #1 align 2 !dbg !16 {
107*9880d681SAndroid Build Coastguard Workerentry:
108*9880d681SAndroid Build Coastguard Worker  %this.addr = alloca %struct.C*, align 8
109*9880d681SAndroid Build Coastguard Worker  store %struct.C* %this, %struct.C** %this.addr, align 8
110*9880d681SAndroid Build Coastguard Worker  call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !32, metadata !DIExpression()), !dbg !40
111*9880d681SAndroid Build Coastguard Worker  %this1 = load %struct.C*, %struct.C** %this.addr
112*9880d681SAndroid Build Coastguard Worker  ret void, !dbg !41
113*9880d681SAndroid Build Coastguard Worker}
114*9880d681SAndroid Build Coastguard Worker
115*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone
116*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.declare(metadata, metadata, metadata) #2
117*9880d681SAndroid Build Coastguard Worker
118*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
119*9880d681SAndroid Build Coastguard Workerattributes #1 = { alwaysinline nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
120*9880d681SAndroid Build Coastguard Workerattributes #2 = { nounwind readnone }
121*9880d681SAndroid Build Coastguard Worker
122*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0}
123*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!18, !19}
124*9880d681SAndroid Build Coastguard Worker!llvm.ident = !{!20}
125*9880d681SAndroid Build Coastguard Worker
126*9880d681SAndroid Build Coastguard Worker!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !3, globals: !2, imports: !2)
127*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "<stdin>", directory: "/tmp/dbginfo")
128*9880d681SAndroid Build Coastguard Worker!2 = !{}
129*9880d681SAndroid Build Coastguard Worker!3 = !{!4}
130*9880d681SAndroid Build Coastguard Worker!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", line: 1, size: 8, align: 8, file: !5, elements: !6, identifier: "_ZTS1C")
131*9880d681SAndroid Build Coastguard Worker!5 = !DIFile(filename: "PR20038.cpp", directory: "/tmp/dbginfo")
132*9880d681SAndroid Build Coastguard Worker!6 = !{!7}
133*9880d681SAndroid Build Coastguard Worker!7 = !DISubprogram(name: "~C", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !5, scope: !4, type: !8)
134*9880d681SAndroid Build Coastguard Worker!8 = !DISubroutineType(types: !9)
135*9880d681SAndroid Build Coastguard Worker!9 = !{null, !10}
136*9880d681SAndroid Build Coastguard Worker!10 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4)
137*9880d681SAndroid Build Coastguard Worker!12 = distinct !DISubprogram(name: "fun4", linkageName: "_Z4fun4v", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 5, file: !5, scope: !13, type: !14, variables: !2)
138*9880d681SAndroid Build Coastguard Worker!13 = !DIFile(filename: "PR20038.cpp", directory: "/tmp/dbginfo")
139*9880d681SAndroid Build Coastguard Worker!14 = !DISubroutineType(types: !15)
140*9880d681SAndroid Build Coastguard Worker!15 = !{null}
141*9880d681SAndroid Build Coastguard Worker!16 = distinct !DISubprogram(name: "~C", linkageName: "_ZN1CD2Ev", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 6, file: !5, scope: !4, type: !8, declaration: !7, variables: !2)
142*9880d681SAndroid Build Coastguard Worker!17 = distinct !DISubprogram(name: "~C", linkageName: "_ZN1CD1Ev", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 6, file: !5, scope: !4, type: !8, declaration: !7, variables: !2)
143*9880d681SAndroid Build Coastguard Worker!18 = !{i32 2, !"Dwarf Version", i32 4}
144*9880d681SAndroid Build Coastguard Worker!19 = !{i32 2, !"Debug Info Version", i32 3}
145*9880d681SAndroid Build Coastguard Worker!20 = !{!"clang version 3.5.0 "}
146*9880d681SAndroid Build Coastguard Worker!21 = !DILocation(line: 6, scope: !17, inlinedAt: !22)
147*9880d681SAndroid Build Coastguard Worker!22 = !DILocation(line: 5, scope: !23)
148*9880d681SAndroid Build Coastguard Worker!23 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12)
149*9880d681SAndroid Build Coastguard Worker!24 = !DILocation(line: 5, scope: !12)
150*9880d681SAndroid Build Coastguard Worker!25 = !DILocation(line: 5, scope: !26)
151*9880d681SAndroid Build Coastguard Worker!26 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12)
152*9880d681SAndroid Build Coastguard Worker!27 = !DILocation(line: 5, scope: !28)
153*9880d681SAndroid Build Coastguard Worker!28 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12)
154*9880d681SAndroid Build Coastguard Worker!29 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !17, type: !30)
155*9880d681SAndroid Build Coastguard Worker!30 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !4)
156*9880d681SAndroid Build Coastguard Worker!31 = !DILocation(line: 0, scope: !17, inlinedAt: !22)
157*9880d681SAndroid Build Coastguard Worker!32 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30)
158*9880d681SAndroid Build Coastguard Worker!33 = !DILocation(line: 0, scope: !16, inlinedAt: !21)
159*9880d681SAndroid Build Coastguard Worker
160*9880d681SAndroid Build Coastguard Worker!129 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !17, type: !30)
161*9880d681SAndroid Build Coastguard Worker!132 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30)
162*9880d681SAndroid Build Coastguard Worker!232 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30)
163*9880d681SAndroid Build Coastguard Worker
164*9880d681SAndroid Build Coastguard Worker!34 = !DILocation(line: 5, scope: !35)
165*9880d681SAndroid Build Coastguard Worker!35 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !36)
166*9880d681SAndroid Build Coastguard Worker!36 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12)
167*9880d681SAndroid Build Coastguard Worker!37 = !DILocation(line: 6, scope: !17)
168*9880d681SAndroid Build Coastguard Worker!38 = !DILocation(line: 0, scope: !17)
169*9880d681SAndroid Build Coastguard Worker!39 = !DILocation(line: 0, scope: !16, inlinedAt: !37)
170*9880d681SAndroid Build Coastguard Worker!40 = !DILocation(line: 0, scope: !16)
171*9880d681SAndroid Build Coastguard Worker!41 = !DILocation(line: 6, scope: !16)
172