blob: 41b60c5174c55360a7e9e7e0d9ec575e31479679 [file] [log] [blame]
David Blaikieb9597a82014-06-15 19:34:26 +00001; REQUIRES: object-emission
2
James Y Knight0cab80c2015-08-07 23:01:16 +00003; For some reason, the output when targetting sparc is not quite as expected.
4; XFAIL: sparc
5
Adrian Prantl16aa4cf2017-09-11 23:05:20 +00006; RUN: %llc_dwarf -O0 -filetype=obj -dwarf-linkage-names=All < %s | llvm-dwarfdump -v -debug-info - | FileCheck %s
David Blaikieb9597a82014-06-15 19:34:26 +00007
8; IR generated from clang -O0 with:
9; struct C {
10; ~C();
11; };
12; extern bool b;
13; void fun4() { b && (C(), 1); }
14; __attribute__((always_inline)) C::~C() { }
15
16; CHECK: DW_TAG_structure_type
17; CHECK-NOT: DW_TAG
18; CHECK: DW_AT_name {{.*}} "C"
19; CHECK-NOT: {{DW_TAG|NULL}}
Frederic Rissd4de1802014-10-10 15:51:02 +000020; CHECK: DW_TAG_subprogram
David Blaikieb9597a82014-06-15 19:34:26 +000021; CHECK-NOT: DW_TAG
22; CHECK: DW_AT_name {{.*}} "~C"
23
Frederic Rissd1cfc3c2014-10-06 03:36:31 +000024; CHECK: DW_TAG_subprogram
David Blaikie9408f522014-07-02 18:32:05 +000025; CHECK-NOT: DW_TAG
Paul Robinson857b4432015-03-10 22:44:45 +000026; CHECK: DW_AT_linkage_name {{.*}} "_ZN1CD1Ev"
David Blaikie9408f522014-07-02 18:32:05 +000027; CHECK-NOT: {{DW_TAG|NULL}}
Frederic Rissd4de1802014-10-10 15:51:02 +000028; CHECK: DW_TAG_formal_parameter
David Blaikie9408f522014-07-02 18:32:05 +000029; CHECK-NOT: DW_TAG
30; CHECK: DW_AT_name {{.*}} "this"
31
David Blaikieb9597a82014-06-15 19:34:26 +000032; CHECK: DW_TAG_subprogram
33; CHECK-NOT: DW_TAG
34; CHECK: DW_AT_name {{.*}} "fun4"
David Blaikie9408f522014-07-02 18:32:05 +000035; CHECK-NOT: {{DW_TAG|NULL}}
David Blaikie6a150a82014-08-31 21:26:22 +000036; CHECK: DW_TAG_inlined_subroutine
David Blaikieb89e6d92014-07-01 03:11:59 +000037; CHECK-NOT: DW_TAG
Frederic Rissd1cfc3c2014-10-06 03:36:31 +000038; CHECK: DW_AT_abstract_origin {{.*}} "_ZN1CD1Ev"
David Blaikie9408f522014-07-02 18:32:05 +000039; CHECK-NOT: {{DW_TAG|NULL}}
David Blaikie6a150a82014-08-31 21:26:22 +000040; CHECK: DW_TAG_formal_parameter
David Blaikie9408f522014-07-02 18:32:05 +000041; CHECK-NOT: DW_TAG
Frederic Rissd4de1802014-10-10 15:51:02 +000042; CHECK: DW_AT_abstract_origin {{.*}} "this"
David Blaikiec8caa172014-07-01 04:11:45 +000043
David Blaikie9408f522014-07-02 18:32:05 +000044; FIXME: D2 is actually inlined into D1 but doesn't show up here, possibly due
45; to there being no work in D2 (calling another member function from the dtor
46; causes D2 to show up, calling a free function doesn't).
David Blaikiec8caa172014-07-01 04:11:45 +000047
David Blaikie9408f522014-07-02 18:32:05 +000048; CHECK-NOT: DW_TAG
David Blaikie9408f522014-07-02 18:32:05 +000049; CHECK: NULL
50; CHECK-NOT: DW_TAG
51; CHECK: NULL
David Blaikieb9597a82014-06-15 19:34:26 +000052
53%struct.C = type { i8 }
54
55@b = external global i8
56
57; Function Attrs: nounwind
Peter Collingbourned4bff302015-11-05 22:03:56 +000058define void @_Z4fun4v() #0 !dbg !12 {
David Blaikieb9597a82014-06-15 19:34:26 +000059entry:
60 %this.addr.i.i = alloca %struct.C*, align 8, !dbg !21
David Blaikie9408f522014-07-02 18:32:05 +000061 %this.addr.i = alloca %struct.C*, align 8, !dbg !22
David Blaikieb9597a82014-06-15 19:34:26 +000062 %agg.tmp.ensured = alloca %struct.C, align 1
63 %cleanup.cond = alloca i1
David Blaikiea79ac142015-02-27 21:17:42 +000064 %0 = load i8, i8* @b, align 1, !dbg !24
David Blaikie9408f522014-07-02 18:32:05 +000065 %tobool = trunc i8 %0 to i1, !dbg !24
David Blaikieb9597a82014-06-15 19:34:26 +000066 store i1 false, i1* %cleanup.cond
David Blaikie9408f522014-07-02 18:32:05 +000067 br i1 %tobool, label %land.rhs, label %land.end, !dbg !24
David Blaikieb9597a82014-06-15 19:34:26 +000068
69land.rhs: ; preds = %entry
David Blaikie9408f522014-07-02 18:32:05 +000070 store i1 true, i1* %cleanup.cond, !dbg !25
David Blaikieb9597a82014-06-15 19:34:26 +000071 br label %land.end
72
73land.end: ; preds = %land.rhs, %entry
74 %1 = phi i1 [ false, %entry ], [ true, %land.rhs ]
David Blaikiea79ac142015-02-27 21:17:42 +000075 %cleanup.is_active = load i1, i1* %cleanup.cond, !dbg !27
David Blaikie9408f522014-07-02 18:32:05 +000076 br i1 %cleanup.is_active, label %cleanup.action, label %cleanup.done, !dbg !27
David Blaikieb9597a82014-06-15 19:34:26 +000077
78cleanup.action: ; preds = %land.end
David Blaikie9408f522014-07-02 18:32:05 +000079 store %struct.C* %agg.tmp.ensured, %struct.C** %this.addr.i, align 8, !dbg !22
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000080 call void @llvm.dbg.declare(metadata %struct.C** %this.addr.i, metadata !129, metadata !DIExpression()), !dbg !31
David Blaikiea79ac142015-02-27 21:17:42 +000081 %this1.i = load %struct.C*, %struct.C** %this.addr.i, !dbg !22
David Blaikieb9597a82014-06-15 19:34:26 +000082 store %struct.C* %this1.i, %struct.C** %this.addr.i.i, align 8, !dbg !21
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000083 call void @llvm.dbg.declare(metadata %struct.C** %this.addr.i.i, metadata !132, metadata !DIExpression()), !dbg !33
David Blaikiea79ac142015-02-27 21:17:42 +000084 %this1.i.i = load %struct.C*, %struct.C** %this.addr.i.i, !dbg !21
David Blaikie9408f522014-07-02 18:32:05 +000085 br label %cleanup.done, !dbg !22
David Blaikieb9597a82014-06-15 19:34:26 +000086
87cleanup.done: ; preds = %cleanup.action, %land.end
David Blaikie9408f522014-07-02 18:32:05 +000088 ret void, !dbg !34
David Blaikieb9597a82014-06-15 19:34:26 +000089}
90
91; Function Attrs: alwaysinline nounwind
Peter Collingbourned4bff302015-11-05 22:03:56 +000092define void @_ZN1CD1Ev(%struct.C* %this) unnamed_addr #1 align 2 !dbg !17 {
David Blaikieb9597a82014-06-15 19:34:26 +000093entry:
David Blaikie9408f522014-07-02 18:32:05 +000094 %this.addr.i = alloca %struct.C*, align 8, !dbg !37
David Blaikieb9597a82014-06-15 19:34:26 +000095 %this.addr = alloca %struct.C*, align 8
96 store %struct.C* %this, %struct.C** %this.addr, align 8
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000097 call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !29, metadata !DIExpression()), !dbg !38
David Blaikiea79ac142015-02-27 21:17:42 +000098 %this1 = load %struct.C*, %struct.C** %this.addr
David Blaikie9408f522014-07-02 18:32:05 +000099 store %struct.C* %this1, %struct.C** %this.addr.i, align 8, !dbg !37
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000100 call void @llvm.dbg.declare(metadata %struct.C** %this.addr.i, metadata !232, metadata !DIExpression()), !dbg !39
David Blaikiea79ac142015-02-27 21:17:42 +0000101 %this1.i = load %struct.C*, %struct.C** %this.addr.i, !dbg !37
David Blaikie9408f522014-07-02 18:32:05 +0000102 ret void, !dbg !37
David Blaikieb9597a82014-06-15 19:34:26 +0000103}
104
105; Function Attrs: alwaysinline nounwind
Peter Collingbourned4bff302015-11-05 22:03:56 +0000106define void @_ZN1CD2Ev(%struct.C* %this) unnamed_addr #1 align 2 !dbg !16 {
David Blaikieb9597a82014-06-15 19:34:26 +0000107entry:
108 %this.addr = alloca %struct.C*, align 8
109 store %struct.C* %this, %struct.C** %this.addr, align 8
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000110 call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !32, metadata !DIExpression()), !dbg !40
David Blaikiea79ac142015-02-27 21:17:42 +0000111 %this1 = load %struct.C*, %struct.C** %this.addr
David Blaikie9408f522014-07-02 18:32:05 +0000112 ret void, !dbg !41
David Blaikieb9597a82014-06-15 19:34:26 +0000113}
114
115; Function Attrs: nounwind readnone
Adrian Prantl87b7eb92014-10-01 18:55:02 +0000116declare void @llvm.dbg.declare(metadata, metadata, metadata) #2
David Blaikieb9597a82014-06-15 19:34:26 +0000117
118attributes #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" }
119attributes #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" }
120attributes #2 = { nounwind readnone }
121
122!llvm.dbg.cu = !{!0}
123!llvm.module.flags = !{!18, !19}
124!llvm.ident = !{!20}
125
Adrian Prantl75819ae2016-04-15 15:57:41 +0000126!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)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000127!1 = !DIFile(filename: "<stdin>", directory: "/tmp/dbginfo")
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000128!2 = !{}
129!3 = !{!4}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000130!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", line: 1, size: 8, align: 8, file: !5, elements: !6, identifier: "_ZTS1C")
131!5 = !DIFile(filename: "PR20038.cpp", directory: "/tmp/dbginfo")
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000132!6 = !{!7}
Duncan P. N. Exon Smitha59d3e52016-04-23 21:08:00 +0000133!7 = !DISubprogram(name: "~C", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !5, scope: !4, type: !8)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000134!8 = !DISubroutineType(types: !9)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000135!9 = !{null, !10}
Duncan P. N. Exon Smitha59d3e52016-04-23 21:08:00 +0000136!10 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4)
Adrian Prantl75819ae2016-04-15 15:57:41 +0000137!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)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000138!13 = !DIFile(filename: "PR20038.cpp", directory: "/tmp/dbginfo")
139!14 = !DISubroutineType(types: !15)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000140!15 = !{null}
Duncan P. N. Exon Smitha59d3e52016-04-23 21:08:00 +0000141!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!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)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000143!18 = !{i32 2, !"Dwarf Version", i32 4}
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +0000144!19 = !{i32 2, !"Debug Info Version", i32 3}
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000145!20 = !{!"clang version 3.5.0 "}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000146!21 = !DILocation(line: 6, scope: !17, inlinedAt: !22)
147!22 = !DILocation(line: 5, scope: !23)
148!23 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12)
149!24 = !DILocation(line: 5, scope: !12)
150!25 = !DILocation(line: 5, scope: !26)
151!26 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12)
152!27 = !DILocation(line: 5, scope: !28)
153!28 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12)
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +0000154!29 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !17, type: !30)
Duncan P. N. Exon Smitha59d3e52016-04-23 21:08:00 +0000155!30 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !4)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000156!31 = !DILocation(line: 0, scope: !17, inlinedAt: !22)
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +0000157!32 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000158!33 = !DILocation(line: 0, scope: !16, inlinedAt: !21)
Duncan P. N. Exon Smith81f522a2015-04-03 16:54:30 +0000159
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +0000160!129 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !17, type: !30)
161!132 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30)
162!232 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30)
Duncan P. N. Exon Smith81f522a2015-04-03 16:54:30 +0000163
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000164!34 = !DILocation(line: 5, scope: !35)
165!35 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !36)
166!36 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12)
167!37 = !DILocation(line: 6, scope: !17)
168!38 = !DILocation(line: 0, scope: !17)
169!39 = !DILocation(line: 0, scope: !16, inlinedAt: !37)
170!40 = !DILocation(line: 0, scope: !16)
171!41 = !DILocation(line: 6, scope: !16)