1 ; REQUIRES: object-emission
3 ; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s
5 ; IR generated from clang -O0 with:
10 ; void fun4() { b && (C(), 1); }
11 ; __attribute__((always_inline)) C::~C() { }
13 ; CHECK: DW_TAG_structure_type
15 ; CHECK: DW_AT_name {{.*}} "C"
16 ; CHECK-NOT: {{DW_TAG|NULL}}
17 ; CHECK: DW_TAG_subprogram
19 ; CHECK: DW_AT_name {{.*}} "~C"
21 ; CHECK: DW_TAG_subprogram
23 ; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN1CD1Ev"
24 ; CHECK-NOT: {{DW_TAG|NULL}}
25 ; CHECK: DW_TAG_formal_parameter
27 ; CHECK: DW_AT_name {{.*}} "this"
29 ; CHECK: DW_TAG_subprogram
31 ; CHECK: DW_AT_name {{.*}} "fun4"
32 ; CHECK-NOT: {{DW_TAG|NULL}}
33 ; CHECK: DW_TAG_inlined_subroutine
35 ; CHECK: DW_AT_abstract_origin {{.*}} "_ZN1CD1Ev"
36 ; CHECK-NOT: {{DW_TAG|NULL}}
37 ; CHECK: DW_TAG_formal_parameter
39 ; CHECK: DW_AT_abstract_origin {{.*}} "this"
41 ; 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).
50 %struct.C = type { i8 }
52 @b = external global i8
54 ; Function Attrs: nounwind
55 define void @_Z4fun4v() #0 {
57 %this.addr.i.i = alloca %struct.C*, align 8, !dbg !21
58 %this.addr.i = alloca %struct.C*, align 8, !dbg !22
59 %agg.tmp.ensured = alloca %struct.C, align 1
60 %cleanup.cond = alloca i1
61 %0 = load i8, i8* @b, align 1, !dbg !24
62 %tobool = trunc i8 %0 to i1, !dbg !24
63 store i1 false, i1* %cleanup.cond
64 br i1 %tobool, label %land.rhs, label %land.end, !dbg !24
66 land.rhs: ; preds = %entry
67 store i1 true, i1* %cleanup.cond, !dbg !25
70 land.end: ; preds = %land.rhs, %entry
71 %1 = phi i1 [ false, %entry ], [ true, %land.rhs ]
72 %cleanup.is_active = load i1, i1* %cleanup.cond, !dbg !27
73 br i1 %cleanup.is_active, label %cleanup.action, label %cleanup.done, !dbg !27
75 cleanup.action: ; preds = %land.end
76 store %struct.C* %agg.tmp.ensured, %struct.C** %this.addr.i, align 8, !dbg !22
77 call void @llvm.dbg.declare(metadata %struct.C** %this.addr.i, metadata !29, metadata !MDExpression()), !dbg !31
78 %this1.i = load %struct.C*, %struct.C** %this.addr.i, !dbg !22
79 store %struct.C* %this1.i, %struct.C** %this.addr.i.i, align 8, !dbg !21
80 call void @llvm.dbg.declare(metadata %struct.C** %this.addr.i.i, metadata !32, metadata !MDExpression()), !dbg !33
81 %this1.i.i = load %struct.C*, %struct.C** %this.addr.i.i, !dbg !21
82 br label %cleanup.done, !dbg !22
84 cleanup.done: ; preds = %cleanup.action, %land.end
88 ; Function Attrs: alwaysinline nounwind
89 define void @_ZN1CD1Ev(%struct.C* %this) unnamed_addr #1 align 2 {
91 %this.addr.i = alloca %struct.C*, align 8, !dbg !37
92 %this.addr = alloca %struct.C*, align 8
93 store %struct.C* %this, %struct.C** %this.addr, align 8
94 call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !29, metadata !MDExpression()), !dbg !38
95 %this1 = load %struct.C*, %struct.C** %this.addr
96 store %struct.C* %this1, %struct.C** %this.addr.i, align 8, !dbg !37
97 call void @llvm.dbg.declare(metadata %struct.C** %this.addr.i, metadata !32, metadata !MDExpression()), !dbg !39
98 %this1.i = load %struct.C*, %struct.C** %this.addr.i, !dbg !37
102 ; Function Attrs: alwaysinline nounwind
103 define void @_ZN1CD2Ev(%struct.C* %this) unnamed_addr #1 align 2 {
105 %this.addr = alloca %struct.C*, align 8
106 store %struct.C* %this, %struct.C** %this.addr, align 8
107 call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !32, metadata !MDExpression()), !dbg !40
108 %this1 = load %struct.C*, %struct.C** %this.addr
112 ; Function Attrs: nounwind readnone
113 declare void @llvm.dbg.declare(metadata, metadata, metadata) #2
115 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" }
116 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" }
117 attributes #2 = { nounwind readnone }
120 !llvm.module.flags = !{!18, !19}
123 !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")
127 !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")
130 !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)
133 !10 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1C")
134 !11 = !{!12, !16, !17}
135 !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)
139 !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)
141 !18 = !{i32 2, !"Dwarf Version", i32 4}
142 !19 = !{i32 2, !"Debug Info Version", i32 3}
143 !20 = !{!"clang version 3.5.0 "}
144 !21 = !MDLocation(line: 6, scope: !17, inlinedAt: !22)
145 !22 = !MDLocation(line: 5, scope: !23)
146 !23 = distinct !MDLexicalBlock(line: 5, column: 0, file: !5, scope: !12)
147 !24 = !MDLocation(line: 5, scope: !12)
148 !25 = !MDLocation(line: 5, scope: !26)
149 !26 = distinct !MDLexicalBlock(line: 5, column: 0, file: !5, scope: !12)
150 !27 = !MDLocation(line: 5, scope: !28)
151 !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")
154 !31 = !MDLocation(line: 0, scope: !17, inlinedAt: !22)
155 !32 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30)
156 !33 = !MDLocation(line: 0, scope: !16, inlinedAt: !21)
157 !34 = !MDLocation(line: 5, scope: !35)
158 !35 = distinct !MDLexicalBlock(line: 5, column: 0, file: !5, scope: !36)
159 !36 = distinct !MDLexicalBlock(line: 5, column: 0, file: !5, scope: !12)
160 !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)