blob: b7ac8936613f4f640c5bb52bbd3545539ea9bb6b [file] [log] [blame]
David Blaikieb9597a82014-06-15 19:34:26 +00001; REQUIRES: object-emission
2
3; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s
4
5; IR generated from clang -O0 with:
6; struct C {
7; ~C();
8; };
9; extern bool b;
10; void fun4() { b && (C(), 1); }
11; __attribute__((always_inline)) C::~C() { }
12
13; CHECK: DW_TAG_structure_type
14; CHECK-NOT: DW_TAG
15; CHECK: DW_AT_name {{.*}} "C"
16; CHECK-NOT: {{DW_TAG|NULL}}
Frederic Rissd4de1802014-10-10 15:51:02 +000017; CHECK: DW_TAG_subprogram
David Blaikieb9597a82014-06-15 19:34:26 +000018; CHECK-NOT: DW_TAG
19; CHECK: DW_AT_name {{.*}} "~C"
20
Frederic Rissd1cfc3c2014-10-06 03:36:31 +000021; CHECK: DW_TAG_subprogram
David Blaikie9408f522014-07-02 18:32:05 +000022; CHECK-NOT: DW_TAG
Paul Robinson857b4432015-03-10 22:44:45 +000023; CHECK: DW_AT_linkage_name {{.*}} "_ZN1CD1Ev"
David Blaikie9408f522014-07-02 18:32:05 +000024; CHECK-NOT: {{DW_TAG|NULL}}
Frederic Rissd4de1802014-10-10 15:51:02 +000025; CHECK: DW_TAG_formal_parameter
David Blaikie9408f522014-07-02 18:32:05 +000026; CHECK-NOT: DW_TAG
27; CHECK: DW_AT_name {{.*}} "this"
28
David Blaikieb9597a82014-06-15 19:34:26 +000029; CHECK: DW_TAG_subprogram
30; CHECK-NOT: DW_TAG
31; CHECK: DW_AT_name {{.*}} "fun4"
David Blaikie9408f522014-07-02 18:32:05 +000032; CHECK-NOT: {{DW_TAG|NULL}}
David Blaikie6a150a82014-08-31 21:26:22 +000033; CHECK: DW_TAG_inlined_subroutine
David Blaikieb89e6d92014-07-01 03:11:59 +000034; CHECK-NOT: DW_TAG
Frederic Rissd1cfc3c2014-10-06 03:36:31 +000035; CHECK: DW_AT_abstract_origin {{.*}} "_ZN1CD1Ev"
David Blaikie9408f522014-07-02 18:32:05 +000036; CHECK-NOT: {{DW_TAG|NULL}}
David Blaikie6a150a82014-08-31 21:26:22 +000037; CHECK: DW_TAG_formal_parameter
David Blaikie9408f522014-07-02 18:32:05 +000038; CHECK-NOT: DW_TAG
Frederic Rissd4de1802014-10-10 15:51:02 +000039; CHECK: DW_AT_abstract_origin {{.*}} "this"
David Blaikiec8caa172014-07-01 04:11:45 +000040
David Blaikie9408f522014-07-02 18:32:05 +000041; FIXME: D2 is actually inlined into D1 but doesn't show up here, possibly due
42; to there being no work in D2 (calling another member function from the dtor
43; causes D2 to show up, calling a free function doesn't).
David Blaikiec8caa172014-07-01 04:11:45 +000044
David Blaikie9408f522014-07-02 18:32:05 +000045; CHECK-NOT: DW_TAG
David Blaikie9408f522014-07-02 18:32:05 +000046; CHECK: NULL
47; CHECK-NOT: DW_TAG
48; CHECK: NULL
David Blaikieb9597a82014-06-15 19:34:26 +000049
50%struct.C = type { i8 }
51
52@b = external global i8
53
54; Function Attrs: nounwind
55define void @_Z4fun4v() #0 {
56entry:
57 %this.addr.i.i = alloca %struct.C*, align 8, !dbg !21
David Blaikie9408f522014-07-02 18:32:05 +000058 %this.addr.i = alloca %struct.C*, align 8, !dbg !22
David Blaikieb9597a82014-06-15 19:34:26 +000059 %agg.tmp.ensured = alloca %struct.C, align 1
60 %cleanup.cond = alloca i1
David Blaikiea79ac142015-02-27 21:17:42 +000061 %0 = load i8, i8* @b, align 1, !dbg !24
David Blaikie9408f522014-07-02 18:32:05 +000062 %tobool = trunc i8 %0 to i1, !dbg !24
David Blaikieb9597a82014-06-15 19:34:26 +000063 store i1 false, i1* %cleanup.cond
David Blaikie9408f522014-07-02 18:32:05 +000064 br i1 %tobool, label %land.rhs, label %land.end, !dbg !24
David Blaikieb9597a82014-06-15 19:34:26 +000065
66land.rhs: ; preds = %entry
David Blaikie9408f522014-07-02 18:32:05 +000067 store i1 true, i1* %cleanup.cond, !dbg !25
David Blaikieb9597a82014-06-15 19:34:26 +000068 br label %land.end
69
70land.end: ; preds = %land.rhs, %entry
71 %1 = phi i1 [ false, %entry ], [ true, %land.rhs ]
David Blaikiea79ac142015-02-27 21:17:42 +000072 %cleanup.is_active = load i1, i1* %cleanup.cond, !dbg !27
David Blaikie9408f522014-07-02 18:32:05 +000073 br i1 %cleanup.is_active, label %cleanup.action, label %cleanup.done, !dbg !27
David Blaikieb9597a82014-06-15 19:34:26 +000074
75cleanup.action: ; preds = %land.end
David Blaikie9408f522014-07-02 18:32:05 +000076 store %struct.C* %agg.tmp.ensured, %struct.C** %this.addr.i, align 8, !dbg !22
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000077 call void @llvm.dbg.declare(metadata %struct.C** %this.addr.i, metadata !29, metadata !MDExpression()), !dbg !31
David Blaikiea79ac142015-02-27 21:17:42 +000078 %this1.i = load %struct.C*, %struct.C** %this.addr.i, !dbg !22
David Blaikieb9597a82014-06-15 19:34:26 +000079 store %struct.C* %this1.i, %struct.C** %this.addr.i.i, align 8, !dbg !21
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000080 call void @llvm.dbg.declare(metadata %struct.C** %this.addr.i.i, metadata !32, metadata !MDExpression()), !dbg !33
David Blaikiea79ac142015-02-27 21:17:42 +000081 %this1.i.i = load %struct.C*, %struct.C** %this.addr.i.i, !dbg !21
David Blaikie9408f522014-07-02 18:32:05 +000082 br label %cleanup.done, !dbg !22
David Blaikieb9597a82014-06-15 19:34:26 +000083
84cleanup.done: ; preds = %cleanup.action, %land.end
David Blaikie9408f522014-07-02 18:32:05 +000085 ret void, !dbg !34
David Blaikieb9597a82014-06-15 19:34:26 +000086}
87
88; Function Attrs: alwaysinline nounwind
89define void @_ZN1CD1Ev(%struct.C* %this) unnamed_addr #1 align 2 {
90entry:
David Blaikie9408f522014-07-02 18:32:05 +000091 %this.addr.i = alloca %struct.C*, align 8, !dbg !37
David Blaikieb9597a82014-06-15 19:34:26 +000092 %this.addr = alloca %struct.C*, align 8
93 store %struct.C* %this, %struct.C** %this.addr, align 8
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000094 call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !29, metadata !MDExpression()), !dbg !38
David Blaikiea79ac142015-02-27 21:17:42 +000095 %this1 = load %struct.C*, %struct.C** %this.addr
David Blaikie9408f522014-07-02 18:32:05 +000096 store %struct.C* %this1, %struct.C** %this.addr.i, align 8, !dbg !37
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000097 call void @llvm.dbg.declare(metadata %struct.C** %this.addr.i, metadata !32, metadata !MDExpression()), !dbg !39
David Blaikiea79ac142015-02-27 21:17:42 +000098 %this1.i = load %struct.C*, %struct.C** %this.addr.i, !dbg !37
David Blaikie9408f522014-07-02 18:32:05 +000099 ret void, !dbg !37
David Blaikieb9597a82014-06-15 19:34:26 +0000100}
101
102; Function Attrs: alwaysinline nounwind
103define void @_ZN1CD2Ev(%struct.C* %this) unnamed_addr #1 align 2 {
104entry:
105 %this.addr = alloca %struct.C*, align 8
106 store %struct.C* %this, %struct.C** %this.addr, align 8
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +0000107 call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !32, metadata !MDExpression()), !dbg !40
David Blaikiea79ac142015-02-27 21:17:42 +0000108 %this1 = load %struct.C*, %struct.C** %this.addr
David Blaikie9408f522014-07-02 18:32:05 +0000109 ret void, !dbg !41
David Blaikieb9597a82014-06-15 19:34:26 +0000110}
111
112; Function Attrs: nounwind readnone
Adrian Prantl87b7eb92014-10-01 18:55:02 +0000113declare void @llvm.dbg.declare(metadata, metadata, metadata) #2
David Blaikieb9597a82014-06-15 19:34:26 +0000114
115attributes #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" }
116attributes #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" }
117attributes #2 = { nounwind readnone }
118
119!llvm.dbg.cu = !{!0}
120!llvm.module.flags = !{!18, !19}
121!llvm.ident = !{!20}
122
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +0000123!0 = !MDCompileUnit(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)
124!1 = !MDFile(filename: "<stdin>", directory: "/tmp/dbginfo")
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000125!2 = !{}
126!3 = !{!4}
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +0000127!4 = !MDCompositeType(tag: DW_TAG_structure_type, name: "C", line: 1, size: 8, align: 8, file: !5, elements: !6, identifier: "_ZTS1C")
128!5 = !MDFile(filename: "PR20038.cpp", directory: "/tmp/dbginfo")
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000129!6 = !{!7}
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +0000130!7 = !MDSubprogram(name: "~C", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !5, scope: !"_ZTS1C", type: !8)
131!8 = !MDSubroutineType(types: !9)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000132!9 = !{null, !10}
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +0000133!10 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1C")
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000134!11 = !{!12, !16, !17}
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +0000135!12 = !MDSubprogram(name: "fun4", linkageName: "_Z4fun4v", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 5, file: !5, scope: !13, type: !14, function: void ()* @_Z4fun4v, variables: !2)
136!13 = !MDFile(filename: "PR20038.cpp", directory: "/tmp/dbginfo")
137!14 = !MDSubroutineType(types: !15)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000138!15 = !{null}
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +0000139!16 = !MDSubprogram(name: "~C", linkageName: "_ZN1CD2Ev", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 6, file: !5, scope: !"_ZTS1C", type: !8, function: void (%struct.C*)* @_ZN1CD2Ev, declaration: !7, variables: !2)
140!17 = !MDSubprogram(name: "~C", linkageName: "_ZN1CD1Ev", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 6, file: !5, scope: !"_ZTS1C", type: !8, function: void (%struct.C*)* @_ZN1CD1Ev, declaration: !7, variables: !2)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000141!18 = !{i32 2, !"Dwarf Version", i32 4}
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +0000142!19 = !{i32 2, !"Debug Info Version", i32 3}
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000143!20 = !{!"clang version 3.5.0 "}
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +0000144!21 = !MDLocation(line: 6, scope: !17, inlinedAt: !22)
145!22 = !MDLocation(line: 5, scope: !23)
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +0000146!23 = distinct !MDLexicalBlock(line: 5, column: 0, file: !5, scope: !12)
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +0000147!24 = !MDLocation(line: 5, scope: !12)
148!25 = !MDLocation(line: 5, scope: !26)
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +0000149!26 = distinct !MDLexicalBlock(line: 5, column: 0, file: !5, scope: !12)
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +0000150!27 = !MDLocation(line: 5, scope: !28)
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +0000151!28 = distinct !MDLexicalBlock(line: 5, column: 0, file: !5, scope: !12)
152!29 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !17, type: !30)
153!30 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS1C")
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +0000154!31 = !MDLocation(line: 0, scope: !17, inlinedAt: !22)
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +0000155!32 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30)
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +0000156!33 = !MDLocation(line: 0, scope: !16, inlinedAt: !21)
157!34 = !MDLocation(line: 5, scope: !35)
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +0000158!35 = distinct !MDLexicalBlock(line: 5, column: 0, file: !5, scope: !36)
159!36 = distinct !MDLexicalBlock(line: 5, column: 0, file: !5, scope: !12)
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +0000160!37 = !MDLocation(line: 6, scope: !17)
161!38 = !MDLocation(line: 0, scope: !17)
162!39 = !MDLocation(line: 0, scope: !16, inlinedAt: !37)
163!40 = !MDLocation(line: 0, scope: !16)
164!41 = !MDLocation(line: 6, scope: !16)