1 ; 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}} 17 ; CHECK: [[C_DTOR_DECL:.*]]: DW_TAG_subprogram 18 ; CHECK-NOT: DW_TAG 19 ; CHECK: DW_AT_name {{.*}} "~C" 20 21 ; CHECK: [[D1_ABS:.*]]: DW_TAG_subprogram 22 ; CHECK-NOT: DW_TAG 23 ; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN1CD1Ev" 24 ; CHECK-NOT: {{DW_TAG|NULL}} 25 ; CHECK: [[D1_THIS_ABS:.*]]: DW_TAG_formal_parameter 26 ; CHECK-NOT: DW_TAG 27 ; CHECK: DW_AT_name {{.*}} "this" 28 29 ; CHECK: DW_TAG_subprogram 30 ; CHECK-NOT: DW_TAG 31 ; CHECK: DW_AT_name {{.*}} "fun4" 32 ; CHECK-NOT: {{DW_TAG|NULL}} 33 ; CHECK: DW_TAG_lexical_block 34 ; CHECK-NOT: {{DW_TAG|NULL}} 35 ; CHECK: DW_TAG_inlined_subroutine 36 ; CHECK-NOT: DW_TAG 37 ; CHECK: DW_AT_abstract_origin {{.*}} {[[D1_ABS]]} 38 ; CHECK-NOT: {{DW_TAG|NULL}} 39 ; CHECK: DW_TAG_formal_parameter 40 ; CHECK-NOT: DW_TAG 41 ; CHECK: DW_AT_abstract_origin {{.*}} {[[D1_THIS_ABS]]} 42 43 ; FIXME: D2 is actually inlined into D1 but doesn't show up here, possibly due 44 ; to there being no work in D2 (calling another member function from the dtor 45 ; causes D2 to show up, calling a free function doesn't). 46 47 ; CHECK-NOT: DW_TAG 48 ; CHECK: NULL 49 ; CHECK-NOT: DW_TAG 50 ; CHECK: NULL 51 ; CHECK-NOT: DW_TAG 52 ; CHECK: NULL 53 54 %struct.C = type { i8 } 55 56 @b = external global i8 57 58 ; Function Attrs: nounwind 59 define void @_Z4fun4v() #0 { 60 entry: 61 %this.addr.i.i = alloca %struct.C*, align 8, !dbg !21 62 %this.addr.i = alloca %struct.C*, align 8, !dbg !22 63 %agg.tmp.ensured = alloca %struct.C, align 1 64 %cleanup.cond = alloca i1 65 %0 = load i8* @b, align 1, !dbg !24 66 %tobool = trunc i8 %0 to i1, !dbg !24 67 store i1 false, i1* %cleanup.cond 68 br i1 %tobool, label %land.rhs, label %land.end, !dbg !24 69 70 land.rhs: ; preds = %entry 71 store i1 true, i1* %cleanup.cond, !dbg !25 72 br label %land.end 73 74 land.end: ; preds = %land.rhs, %entry 75 %1 = phi i1 [ false, %entry ], [ true, %land.rhs ] 76 %cleanup.is_active = load i1* %cleanup.cond, !dbg !27 77 br i1 %cleanup.is_active, label %cleanup.action, label %cleanup.done, !dbg !27 78 79 cleanup.action: ; preds = %land.end 80 store %struct.C* %agg.tmp.ensured, %struct.C** %this.addr.i, align 8, !dbg !22 81 call void @llvm.dbg.declare(metadata !{%struct.C** %this.addr.i}, metadata !29), !dbg !31 82 %this1.i = load %struct.C** %this.addr.i, !dbg !22 83 store %struct.C* %this1.i, %struct.C** %this.addr.i.i, align 8, !dbg !21 84 call void @llvm.dbg.declare(metadata !{%struct.C** %this.addr.i.i}, metadata !32), !dbg !33 85 %this1.i.i = load %struct.C** %this.addr.i.i, !dbg !21 86 br label %cleanup.done, !dbg !22 87 88 cleanup.done: ; preds = %cleanup.action, %land.end 89 ret void, !dbg !34 90 } 91 92 ; Function Attrs: alwaysinline nounwind 93 define void @_ZN1CD1Ev(%struct.C* %this) unnamed_addr #1 align 2 { 94 entry: 95 %this.addr.i = alloca %struct.C*, align 8, !dbg !37 96 %this.addr = alloca %struct.C*, align 8 97 store %struct.C* %this, %struct.C** %this.addr, align 8 98 call void @llvm.dbg.declare(metadata !{%struct.C** %this.addr}, metadata !29), !dbg !38 99 %this1 = load %struct.C** %this.addr 100 store %struct.C* %this1, %struct.C** %this.addr.i, align 8, !dbg !37 101 call void @llvm.dbg.declare(metadata !{%struct.C** %this.addr.i}, metadata !32), !dbg !39 102 %this1.i = load %struct.C** %this.addr.i, !dbg !37 103 ret void, !dbg !37 104 } 105 106 ; Function Attrs: alwaysinline nounwind 107 define void @_ZN1CD2Ev(%struct.C* %this) unnamed_addr #1 align 2 { 108 entry: 109 %this.addr = alloca %struct.C*, align 8 110 store %struct.C* %this, %struct.C** %this.addr, align 8 111 call void @llvm.dbg.declare(metadata !{%struct.C** %this.addr}, metadata !32), !dbg !40 112 %this1 = load %struct.C** %this.addr 113 ret void, !dbg !41 114 } 115 116 ; Function Attrs: nounwind readnone 117 declare void @llvm.dbg.declare(metadata, metadata) #2 118 119 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" } 120 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" } 121 attributes #2 = { nounwind readnone } 122 123 !llvm.dbg.cu = !{!0} 124 !llvm.module.flags = !{!18, !19} 125 !llvm.ident = !{!20} 126 127 !0 = metadata !{i32 786449, metadata !1, i32 4, metadata !"clang version 3.5.0 ", i1 false, metadata !"", i32 0, metadata !2, metadata !3, metadata !11, metadata !2, metadata !2, metadata !"", i32 1} ; [ DW_TAG_compile_unit ] [/tmp/dbginfo/<stdin>] [DW_LANG_C_plus_plus] 128 !1 = metadata !{metadata !"<stdin>", metadata !"/tmp/dbginfo"} 129 !2 = metadata !{} 130 !3 = metadata !{metadata !4} 131 !4 = metadata !{i32 786451, metadata !5, null, metadata !"C", i32 1, i64 8, i64 8, i32 0, i32 0, null, metadata !6, i32 0, null, null, metadata !"_ZTS1C"} ; [ DW_TAG_structure_type ] [C] [line 1, size 8, align 8, offset 0] [def] [from ] 132 !5 = metadata !{metadata !"PR20038.cpp", metadata !"/tmp/dbginfo"} 133 !6 = metadata !{metadata !7} 134 !7 = metadata !{i32 786478, metadata !5, metadata !"_ZTS1C", metadata !"~C", metadata !"~C", metadata !"", i32 2, metadata !8, i1 false, i1 false, i32 0, i32 0, null, i32 256, i1 false, null, null, i32 0, null, i32 2} ; [ DW_TAG_subprogram ] [line 2] [~C] 135 !8 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !9, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] 136 !9 = metadata !{null, metadata !10} 137 !10 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 1088, metadata !"_ZTS1C"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [artificial] [from _ZTS1C] 138 !11 = metadata !{metadata !12, metadata !16, metadata !17} 139 !12 = metadata !{i32 786478, metadata !5, metadata !13, metadata !"fun4", metadata !"fun4", metadata !"_Z4fun4v", i32 5, metadata !14, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void ()* @_Z4fun4v, null, null, metadata !2, i32 5} ; [ DW_TAG_subprogram ] [line 5] [def] [fun4] 140 !13 = metadata !{i32 786473, metadata !5} ; [ DW_TAG_file_type ] [/tmp/dbginfo/PR20038.cpp] 141 !14 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !15, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] 142 !15 = metadata !{null} 143 !16 = metadata !{i32 786478, metadata !5, metadata !"_ZTS1C", metadata !"~C", metadata !"~C", metadata !"_ZN1CD2Ev", i32 6, metadata !8, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void (%struct.C*)* @_ZN1CD2Ev, null, metadata !7, metadata !2, i32 6} ; [ DW_TAG_subprogram ] [line 6] [def] [~C] 144 !17 = metadata !{i32 786478, metadata !5, metadata !"_ZTS1C", metadata !"~C", metadata !"~C", metadata !"_ZN1CD1Ev", i32 6, metadata !8, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void (%struct.C*)* @_ZN1CD1Ev, null, metadata !7, metadata !2, i32 6} ; [ DW_TAG_subprogram ] [line 6] [def] [~C] 145 !18 = metadata !{i32 2, metadata !"Dwarf Version", i32 4} 146 !19 = metadata !{i32 2, metadata !"Debug Info Version", i32 1} 147 !20 = metadata !{metadata !"clang version 3.5.0 "} 148 !21 = metadata !{i32 6, i32 0, metadata !17, metadata !22} 149 !22 = metadata !{i32 5, i32 0, metadata !23, null} 150 !23 = metadata !{i32 786443, metadata !5, metadata !12, i32 5, i32 0, i32 3, i32 3} ; [ DW_TAG_lexical_block ] [/tmp/dbginfo/PR20038.cpp] 151 !24 = metadata !{i32 5, i32 0, metadata !12, null} 152 !25 = metadata !{i32 5, i32 0, metadata !26, null} 153 !26 = metadata !{i32 786443, metadata !5, metadata !12, i32 5, i32 0, i32 1, i32 1} ; [ DW_TAG_lexical_block ] [/tmp/dbginfo/PR20038.cpp] 154 !27 = metadata !{i32 5, i32 0, metadata !28, null} 155 !28 = metadata !{i32 786443, metadata !5, metadata !12, i32 5, i32 0, i32 2, i32 2} ; [ DW_TAG_lexical_block ] [/tmp/dbginfo/PR20038.cpp] 156 !29 = metadata !{i32 786689, metadata !17, metadata !"this", null, i32 16777216, metadata !30, i32 1088, i32 0} ; [ DW_TAG_arg_variable ] [this] [line 0] 157 !30 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !"_ZTS1C"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from _ZTS1C] 158 !31 = metadata !{i32 0, i32 0, metadata !17, metadata !22} 159 !32 = metadata !{i32 786689, metadata !16, metadata !"this", null, i32 16777216, metadata !30, i32 1088, i32 0} ; [ DW_TAG_arg_variable ] [this] [line 0] 160 !33 = metadata !{i32 0, i32 0, metadata !16, metadata !21} 161 !34 = metadata !{i32 5, i32 0, metadata !35, null} 162 !35 = metadata !{i32 786443, metadata !5, metadata !36, i32 5, i32 0, i32 5, i32 5} ; [ DW_TAG_lexical_block ] [/tmp/dbginfo/PR20038.cpp] 163 !36 = metadata !{i32 786443, metadata !5, metadata !12, i32 5, i32 0, i32 4, i32 4} ; [ DW_TAG_lexical_block ] [/tmp/dbginfo/PR20038.cpp] 164 !37 = metadata !{i32 6, i32 0, metadata !17, null} 165 !38 = metadata !{i32 0, i32 0, metadata !17, null} 166 !39 = metadata !{i32 0, i32 0, metadata !16, metadata !37} 167 !40 = metadata !{i32 0, i32 0, metadata !16, null} 168 !41 = metadata !{i32 6, i32 0, metadata !16, null} 169