David Blaikie | b9597a8 | 2014-06-15 19:34:26 +0000 | [diff] [blame] | 1 | ; REQUIRES: object-emission |
| 2 | |
James Y Knight | 0cab80c | 2015-08-07 23:01:16 +0000 | [diff] [blame] | 3 | ; For some reason, the output when targetting sparc is not quite as expected. |
| 4 | ; XFAIL: sparc |
| 5 | |
Paul Robinson | 78046b4 | 2015-08-11 21:36:45 +0000 | [diff] [blame] | 6 | ; RUN: %llc_dwarf -O0 -filetype=obj -dwarf-linkage-names=Enable < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s |
David Blaikie | b9597a8 | 2014-06-15 19:34:26 +0000 | [diff] [blame] | 7 | |
| 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 Riss | d4de180 | 2014-10-10 15:51:02 +0000 | [diff] [blame] | 20 | ; CHECK: DW_TAG_subprogram |
David Blaikie | b9597a8 | 2014-06-15 19:34:26 +0000 | [diff] [blame] | 21 | ; CHECK-NOT: DW_TAG |
| 22 | ; CHECK: DW_AT_name {{.*}} "~C" |
| 23 | |
Frederic Riss | d1cfc3c | 2014-10-06 03:36:31 +0000 | [diff] [blame] | 24 | ; CHECK: DW_TAG_subprogram |
David Blaikie | 9408f52 | 2014-07-02 18:32:05 +0000 | [diff] [blame] | 25 | ; CHECK-NOT: DW_TAG |
Paul Robinson | 857b443 | 2015-03-10 22:44:45 +0000 | [diff] [blame] | 26 | ; CHECK: DW_AT_linkage_name {{.*}} "_ZN1CD1Ev" |
David Blaikie | 9408f52 | 2014-07-02 18:32:05 +0000 | [diff] [blame] | 27 | ; CHECK-NOT: {{DW_TAG|NULL}} |
Frederic Riss | d4de180 | 2014-10-10 15:51:02 +0000 | [diff] [blame] | 28 | ; CHECK: DW_TAG_formal_parameter |
David Blaikie | 9408f52 | 2014-07-02 18:32:05 +0000 | [diff] [blame] | 29 | ; CHECK-NOT: DW_TAG |
| 30 | ; CHECK: DW_AT_name {{.*}} "this" |
| 31 | |
David Blaikie | b9597a8 | 2014-06-15 19:34:26 +0000 | [diff] [blame] | 32 | ; CHECK: DW_TAG_subprogram |
| 33 | ; CHECK-NOT: DW_TAG |
| 34 | ; CHECK: DW_AT_name {{.*}} "fun4" |
David Blaikie | 9408f52 | 2014-07-02 18:32:05 +0000 | [diff] [blame] | 35 | ; CHECK-NOT: {{DW_TAG|NULL}} |
David Blaikie | 6a150a8 | 2014-08-31 21:26:22 +0000 | [diff] [blame] | 36 | ; CHECK: DW_TAG_inlined_subroutine |
David Blaikie | b89e6d9 | 2014-07-01 03:11:59 +0000 | [diff] [blame] | 37 | ; CHECK-NOT: DW_TAG |
Frederic Riss | d1cfc3c | 2014-10-06 03:36:31 +0000 | [diff] [blame] | 38 | ; CHECK: DW_AT_abstract_origin {{.*}} "_ZN1CD1Ev" |
David Blaikie | 9408f52 | 2014-07-02 18:32:05 +0000 | [diff] [blame] | 39 | ; CHECK-NOT: {{DW_TAG|NULL}} |
David Blaikie | 6a150a8 | 2014-08-31 21:26:22 +0000 | [diff] [blame] | 40 | ; CHECK: DW_TAG_formal_parameter |
David Blaikie | 9408f52 | 2014-07-02 18:32:05 +0000 | [diff] [blame] | 41 | ; CHECK-NOT: DW_TAG |
Frederic Riss | d4de180 | 2014-10-10 15:51:02 +0000 | [diff] [blame] | 42 | ; CHECK: DW_AT_abstract_origin {{.*}} "this" |
David Blaikie | c8caa17 | 2014-07-01 04:11:45 +0000 | [diff] [blame] | 43 | |
David Blaikie | 9408f52 | 2014-07-02 18:32:05 +0000 | [diff] [blame] | 44 | ; 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 Blaikie | c8caa17 | 2014-07-01 04:11:45 +0000 | [diff] [blame] | 47 | |
David Blaikie | 9408f52 | 2014-07-02 18:32:05 +0000 | [diff] [blame] | 48 | ; CHECK-NOT: DW_TAG |
David Blaikie | 9408f52 | 2014-07-02 18:32:05 +0000 | [diff] [blame] | 49 | ; CHECK: NULL |
| 50 | ; CHECK-NOT: DW_TAG |
| 51 | ; CHECK: NULL |
David Blaikie | b9597a8 | 2014-06-15 19:34:26 +0000 | [diff] [blame] | 52 | |
| 53 | %struct.C = type { i8 } |
| 54 | |
| 55 | @b = external global i8 |
| 56 | |
| 57 | ; Function Attrs: nounwind |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame^] | 58 | define void @_Z4fun4v() #0 !dbg !12 { |
David Blaikie | b9597a8 | 2014-06-15 19:34:26 +0000 | [diff] [blame] | 59 | entry: |
| 60 | %this.addr.i.i = alloca %struct.C*, align 8, !dbg !21 |
David Blaikie | 9408f52 | 2014-07-02 18:32:05 +0000 | [diff] [blame] | 61 | %this.addr.i = alloca %struct.C*, align 8, !dbg !22 |
David Blaikie | b9597a8 | 2014-06-15 19:34:26 +0000 | [diff] [blame] | 62 | %agg.tmp.ensured = alloca %struct.C, align 1 |
| 63 | %cleanup.cond = alloca i1 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 64 | %0 = load i8, i8* @b, align 1, !dbg !24 |
David Blaikie | 9408f52 | 2014-07-02 18:32:05 +0000 | [diff] [blame] | 65 | %tobool = trunc i8 %0 to i1, !dbg !24 |
David Blaikie | b9597a8 | 2014-06-15 19:34:26 +0000 | [diff] [blame] | 66 | store i1 false, i1* %cleanup.cond |
David Blaikie | 9408f52 | 2014-07-02 18:32:05 +0000 | [diff] [blame] | 67 | br i1 %tobool, label %land.rhs, label %land.end, !dbg !24 |
David Blaikie | b9597a8 | 2014-06-15 19:34:26 +0000 | [diff] [blame] | 68 | |
| 69 | land.rhs: ; preds = %entry |
David Blaikie | 9408f52 | 2014-07-02 18:32:05 +0000 | [diff] [blame] | 70 | store i1 true, i1* %cleanup.cond, !dbg !25 |
David Blaikie | b9597a8 | 2014-06-15 19:34:26 +0000 | [diff] [blame] | 71 | br label %land.end |
| 72 | |
| 73 | land.end: ; preds = %land.rhs, %entry |
| 74 | %1 = phi i1 [ false, %entry ], [ true, %land.rhs ] |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 75 | %cleanup.is_active = load i1, i1* %cleanup.cond, !dbg !27 |
David Blaikie | 9408f52 | 2014-07-02 18:32:05 +0000 | [diff] [blame] | 76 | br i1 %cleanup.is_active, label %cleanup.action, label %cleanup.done, !dbg !27 |
David Blaikie | b9597a8 | 2014-06-15 19:34:26 +0000 | [diff] [blame] | 77 | |
| 78 | cleanup.action: ; preds = %land.end |
David Blaikie | 9408f52 | 2014-07-02 18:32:05 +0000 | [diff] [blame] | 79 | store %struct.C* %agg.tmp.ensured, %struct.C** %this.addr.i, align 8, !dbg !22 |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 80 | call void @llvm.dbg.declare(metadata %struct.C** %this.addr.i, metadata !129, metadata !DIExpression()), !dbg !31 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 81 | %this1.i = load %struct.C*, %struct.C** %this.addr.i, !dbg !22 |
David Blaikie | b9597a8 | 2014-06-15 19:34:26 +0000 | [diff] [blame] | 82 | store %struct.C* %this1.i, %struct.C** %this.addr.i.i, align 8, !dbg !21 |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 83 | call void @llvm.dbg.declare(metadata %struct.C** %this.addr.i.i, metadata !132, metadata !DIExpression()), !dbg !33 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 84 | %this1.i.i = load %struct.C*, %struct.C** %this.addr.i.i, !dbg !21 |
David Blaikie | 9408f52 | 2014-07-02 18:32:05 +0000 | [diff] [blame] | 85 | br label %cleanup.done, !dbg !22 |
David Blaikie | b9597a8 | 2014-06-15 19:34:26 +0000 | [diff] [blame] | 86 | |
| 87 | cleanup.done: ; preds = %cleanup.action, %land.end |
David Blaikie | 9408f52 | 2014-07-02 18:32:05 +0000 | [diff] [blame] | 88 | ret void, !dbg !34 |
David Blaikie | b9597a8 | 2014-06-15 19:34:26 +0000 | [diff] [blame] | 89 | } |
| 90 | |
| 91 | ; Function Attrs: alwaysinline nounwind |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame^] | 92 | define void @_ZN1CD1Ev(%struct.C* %this) unnamed_addr #1 align 2 !dbg !17 { |
David Blaikie | b9597a8 | 2014-06-15 19:34:26 +0000 | [diff] [blame] | 93 | entry: |
David Blaikie | 9408f52 | 2014-07-02 18:32:05 +0000 | [diff] [blame] | 94 | %this.addr.i = alloca %struct.C*, align 8, !dbg !37 |
David Blaikie | b9597a8 | 2014-06-15 19:34:26 +0000 | [diff] [blame] | 95 | %this.addr = alloca %struct.C*, align 8 |
| 96 | store %struct.C* %this, %struct.C** %this.addr, align 8 |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 97 | call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !29, metadata !DIExpression()), !dbg !38 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 98 | %this1 = load %struct.C*, %struct.C** %this.addr |
David Blaikie | 9408f52 | 2014-07-02 18:32:05 +0000 | [diff] [blame] | 99 | store %struct.C* %this1, %struct.C** %this.addr.i, align 8, !dbg !37 |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 100 | call void @llvm.dbg.declare(metadata %struct.C** %this.addr.i, metadata !232, metadata !DIExpression()), !dbg !39 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 101 | %this1.i = load %struct.C*, %struct.C** %this.addr.i, !dbg !37 |
David Blaikie | 9408f52 | 2014-07-02 18:32:05 +0000 | [diff] [blame] | 102 | ret void, !dbg !37 |
David Blaikie | b9597a8 | 2014-06-15 19:34:26 +0000 | [diff] [blame] | 103 | } |
| 104 | |
| 105 | ; Function Attrs: alwaysinline nounwind |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame^] | 106 | define void @_ZN1CD2Ev(%struct.C* %this) unnamed_addr #1 align 2 !dbg !16 { |
David Blaikie | b9597a8 | 2014-06-15 19:34:26 +0000 | [diff] [blame] | 107 | entry: |
| 108 | %this.addr = alloca %struct.C*, align 8 |
| 109 | store %struct.C* %this, %struct.C** %this.addr, align 8 |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 110 | call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !32, metadata !DIExpression()), !dbg !40 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 111 | %this1 = load %struct.C*, %struct.C** %this.addr |
David Blaikie | 9408f52 | 2014-07-02 18:32:05 +0000 | [diff] [blame] | 112 | ret void, !dbg !41 |
David Blaikie | b9597a8 | 2014-06-15 19:34:26 +0000 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | ; Function Attrs: nounwind readnone |
Adrian Prantl | 87b7eb9 | 2014-10-01 18:55:02 +0000 | [diff] [blame] | 116 | declare void @llvm.dbg.declare(metadata, metadata, metadata) #2 |
David Blaikie | b9597a8 | 2014-06-15 19:34:26 +0000 | [diff] [blame] | 117 | |
| 118 | attributes #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 | attributes #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 | attributes #2 = { nounwind readnone } |
| 121 | |
| 122 | !llvm.dbg.cu = !{!0} |
| 123 | !llvm.module.flags = !{!18, !19} |
| 124 | !llvm.ident = !{!20} |
| 125 | |
Duncan P. N. Exon Smith | 55ca964 | 2015-08-03 17:26:41 +0000 | [diff] [blame] | 126 | !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !3, subprograms: !11, globals: !2, imports: !2) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 127 | !1 = !DIFile(filename: "<stdin>", directory: "/tmp/dbginfo") |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 128 | !2 = !{} |
| 129 | !3 = !{!4} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 130 | !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 Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 132 | !6 = !{!7} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 133 | !7 = !DISubprogram(name: "~C", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !5, scope: !"_ZTS1C", type: !8) |
| 134 | !8 = !DISubroutineType(types: !9) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 135 | !9 = !{null, !10} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 136 | !10 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1C") |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 137 | !11 = !{!12, !16, !17} |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame^] | 138 | !12 = distinct !DISubprogram(name: "fun4", linkageName: "_Z4fun4v", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 5, file: !5, scope: !13, type: !14, variables: !2) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 139 | !13 = !DIFile(filename: "PR20038.cpp", directory: "/tmp/dbginfo") |
| 140 | !14 = !DISubroutineType(types: !15) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 141 | !15 = !{null} |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame^] | 142 | !16 = distinct !DISubprogram(name: "~C", linkageName: "_ZN1CD2Ev", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 6, file: !5, scope: !"_ZTS1C", type: !8, declaration: !7, variables: !2) |
| 143 | !17 = distinct !DISubprogram(name: "~C", linkageName: "_ZN1CD1Ev", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 6, file: !5, scope: !"_ZTS1C", type: !8, declaration: !7, variables: !2) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 144 | !18 = !{i32 2, !"Dwarf Version", i32 4} |
Duncan P. N. Exon Smith | e274180 | 2015-03-03 17:24:31 +0000 | [diff] [blame] | 145 | !19 = !{i32 2, !"Debug Info Version", i32 3} |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 146 | !20 = !{!"clang version 3.5.0 "} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 147 | !21 = !DILocation(line: 6, scope: !17, inlinedAt: !22) |
| 148 | !22 = !DILocation(line: 5, scope: !23) |
| 149 | !23 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12) |
| 150 | !24 = !DILocation(line: 5, scope: !12) |
| 151 | !25 = !DILocation(line: 5, scope: !26) |
| 152 | !26 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12) |
| 153 | !27 = !DILocation(line: 5, scope: !28) |
| 154 | !28 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12) |
Duncan P. N. Exon Smith | ed013cd | 2015-07-31 18:58:39 +0000 | [diff] [blame] | 155 | !29 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !17, type: !30) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 156 | !30 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS1C") |
| 157 | !31 = !DILocation(line: 0, scope: !17, inlinedAt: !22) |
Duncan P. N. Exon Smith | ed013cd | 2015-07-31 18:58:39 +0000 | [diff] [blame] | 158 | !32 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 159 | !33 = !DILocation(line: 0, scope: !16, inlinedAt: !21) |
Duncan P. N. Exon Smith | 81f522a | 2015-04-03 16:54:30 +0000 | [diff] [blame] | 160 | |
Duncan P. N. Exon Smith | ed013cd | 2015-07-31 18:58:39 +0000 | [diff] [blame] | 161 | !129 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !17, type: !30) |
| 162 | !132 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30) |
| 163 | !232 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30) |
Duncan P. N. Exon Smith | 81f522a | 2015-04-03 16:54:30 +0000 | [diff] [blame] | 164 | |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 165 | !34 = !DILocation(line: 5, scope: !35) |
| 166 | !35 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !36) |
| 167 | !36 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12) |
| 168 | !37 = !DILocation(line: 6, scope: !17) |
| 169 | !38 = !DILocation(line: 0, scope: !17) |
| 170 | !39 = !DILocation(line: 0, scope: !16, inlinedAt: !37) |
| 171 | !40 = !DILocation(line: 0, scope: !16) |
| 172 | !41 = !DILocation(line: 6, scope: !16) |