1# RUN: llc -o - %s -mtriple=thumbv7-apple-ios -start-before=livedebugvalues | FileCheck %s 2# RUN: llc -o - %s -mtriple=thumbv6-apple-ios -start-before=livedebugvalues | FileCheck %s 3 4# struct A { 5# A(); 6# virtual ~A(); 7# }; 8# struct B : A { 9# B(); 10# virtual ~B(); 11# }; 12# B::B() {} 13# CHECK: __ZN1BC1Ev: 14# CHECK: .loc 1 9 0 prologue_end 15# CHECK-NOT: .loc 1 0 0 prologue_end 16# 17# The location of the prologue_end marker should not be affected by the presence 18# of CFI instructions. 19 20--- | 21 %struct.B = type { %struct.A } 22 %struct.A = type { i32 (...)** } 23 24 @_ZTV1B = external unnamed_addr constant [4 x i8*] 25 26 ; Function Attrs: nounwind 27 define %struct.B* @_ZN1BC2Ev(%struct.B* %this) unnamed_addr #0 align 2 !dbg !31 { 28 entry: 29 tail call void @llvm.dbg.value(metadata %struct.B* %this, metadata !33, metadata !DIExpression()), !dbg !35 30 %0 = bitcast %struct.B* %this to %struct.A*, !dbg !36 31 %call = tail call %struct.A* @_ZN1AC2Ev(%struct.A* %0) #0, !dbg !36 32 %1 = bitcast %struct.B* %this to i32 (...)***, !dbg !36 33 store i32 (...)** bitcast (i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @_ZTV1B, i32 0, i32 2) to i32 (...)**), i32 (...)*** %1, align 4, !dbg !36, !tbaa !37 34 ret %struct.B* %this, !dbg !36 35 } 36 37 declare %struct.A* @_ZN1AC2Ev(%struct.A*) 38 39 ; Function Attrs: nounwind 40 define %struct.B* @_ZN1BC1Ev(%struct.B* %this) unnamed_addr #0 align 2 !dbg !40 { 41 entry: 42 tail call void @llvm.dbg.value(metadata %struct.B* %this, metadata !42, metadata !DIExpression()), !dbg !43 43 tail call void @llvm.dbg.value(metadata %struct.B* %this, metadata !33, metadata !DIExpression()) #0, !dbg !44 44 %0 = bitcast %struct.B* %this to %struct.A*, !dbg !46 45 %call.i = tail call %struct.A* @_ZN1AC2Ev(%struct.A* %0) #0, !dbg !46 46 %1 = bitcast %struct.B* %this to i32 (...)***, !dbg !46 47 store i32 (...)** bitcast (i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @_ZTV1B, i32 0, i32 2) to i32 (...)**), i32 (...)*** %1, align 4, !dbg !46, !tbaa !37 48 ret %struct.B* %this, !dbg !45 49 } 50 51 ; Function Attrs: nounwind readnone speculatable 52 declare void @llvm.dbg.value(metadata, metadata, metadata) #1 53 54 declare void @_Unwind_SjLj_Register({ i8*, i32, [4 x i32], i8*, i8*, [5 x i8*] }*) 55 56 declare void @_Unwind_SjLj_Unregister({ i8*, i32, [4 x i32], i8*, i8*, [5 x i8*] }*) 57 58 ; Function Attrs: nounwind readnone 59 declare i8* @llvm.frameaddress(i32) #2 60 61 ; Function Attrs: nounwind 62 declare i8* @llvm.stacksave() #0 63 64 ; Function Attrs: nounwind 65 declare void @llvm.stackrestore(i8*) #0 66 67 ; Function Attrs: nounwind 68 declare void @llvm.eh.sjlj.setup.dispatch() #0 69 70 ; Function Attrs: nounwind readnone 71 declare i8* @llvm.eh.sjlj.lsda() #2 72 73 ; Function Attrs: nounwind readnone 74 declare void @llvm.eh.sjlj.callsite(i32) #2 75 76 ; Function Attrs: nounwind 77 declare void @llvm.eh.sjlj.functioncontext(i8*) #0 78 79 ; Function Attrs: nounwind 80 declare void @llvm.stackprotector(i8*, i8**) #0 81 82 attributes #0 = { nounwind } 83 attributes #1 = { nounwind readnone speculatable } 84 attributes #2 = { nounwind readnone } 85 86 !llvm.dbg.cu = !{!0} 87 !llvm.module.flags = !{!26, !27, !28, !29} 88 !llvm.ident = !{!30} 89 90 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.6.0 (trunk 224279) (llvm/trunk 224283)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, globals: !2, imports: !2) 91 !1 = !DIFile(filename: "<stdin>", directory: "") 92 !2 = !{} 93 !3 = !{!4, !8} 94 !4 = !DICompositeType(tag: DW_TAG_structure_type, name: "B", file: !5, line: 5, size: 32, align: 32, elements: !6, vtableHolder: !8, identifier: "_ZTS1B") 95 !5 = !DIFile(filename: "test1.cpp", directory: "") 96 !6 = !{!7, !21, !25} 97 !7 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !4, baseType: !8) 98 !8 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !5, line: 1, size: 32, align: 32, elements: !9, vtableHolder: !8, identifier: "_ZTS1A") 99 !9 = !{!10, !16, !20} 100 !10 = !DIDerivedType(tag: DW_TAG_member, name: "_vptr$A", scope: !5, file: !5, baseType: !11, size: 32, flags: DIFlagArtificial) 101 !11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 32) 102 !12 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "__vtbl_ptr_type", baseType: !13, size: 32) 103 !13 = !DISubroutineType(types: !14) 104 !14 = !{!15} 105 !15 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 106 !16 = !DISubprogram(name: "A", scope: !8, file: !5, line: 2, type: !17, isLocal: false, isDefinition: false, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true) 107 !17 = !DISubroutineType(types: !18) 108 !18 = !{null, !19} 109 !19 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !8, size: 32, align: 32, flags: DIFlagArtificial | DIFlagObjectPointer) 110 !20 = !DISubprogram(name: "~A", scope: !8, file: !5, line: 3, type: !17, isLocal: false, isDefinition: false, scopeLine: 3, containingType: !8, virtuality: DW_VIRTUALITY_virtual, virtualIndex: 0, flags: DIFlagPrototyped, isOptimized: true) 111 !21 = !DISubprogram(name: "B", scope: !4, file: !5, line: 6, type: !22, isLocal: false, isDefinition: false, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: true) 112 !22 = !DISubroutineType(types: !23) 113 !23 = !{null, !24} 114 !24 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !4, size: 32, align: 32, flags: DIFlagArtificial | DIFlagObjectPointer) 115 !25 = !DISubprogram(name: "~B", scope: !4, file: !5, line: 7, type: !22, isLocal: false, isDefinition: false, scopeLine: 7, containingType: !4, virtuality: DW_VIRTUALITY_virtual, virtualIndex: 0, flags: DIFlagPrototyped, isOptimized: true) 116 !26 = !{i32 2, !"Dwarf Version", i32 4} 117 !27 = !{i32 2, !"Debug Info Version", i32 3} 118 !28 = !{i32 1, !"wchar_size", i32 4} 119 !29 = !{i32 1, !"min_enum_size", i32 4} 120 !30 = !{!"clang version 3.6.0 (trunk 224279) (llvm/trunk 224283)"} 121 !31 = distinct !DISubprogram(name: "B", linkageName: "_ZN1BC2Ev", scope: !4, file: !5, line: 9, type: !22, isLocal: false, isDefinition: true, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: true, unit: !0, declaration: !21, retainedNodes: !32) 122 !32 = !{!33} 123 !33 = !DILocalVariable(name: "this", arg: 1, scope: !31, type: !34, flags: DIFlagArtificial | DIFlagObjectPointer) 124 !34 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !4, size: 32, align: 32) 125 !35 = !DILocation(line: 0, scope: !31) 126 !36 = !DILocation(line: 9, scope: !31) 127 !37 = !{!38, !38, i64 0} 128 !38 = !{!"vtable pointer", !39, i64 0} 129 !39 = !{!"Simple C/C++ TBAA"} 130 !40 = distinct !DISubprogram(name: "B", linkageName: "_ZN1BC1Ev", scope: !4, file: !5, line: 9, type: !22, isLocal: false, isDefinition: true, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: true, unit: !0, declaration: !21, retainedNodes: !41) 131 !41 = !{!42} 132 !42 = !DILocalVariable(name: "this", arg: 1, scope: !40, type: !34, flags: DIFlagArtificial | DIFlagObjectPointer) 133 !43 = !DILocation(line: 0, scope: !40) 134 !44 = !DILocation(line: 0, scope: !31, inlinedAt: !45) 135 !45 = !DILocation(line: 9, scope: !40) 136 !46 = !DILocation(line: 9, scope: !31, inlinedAt: !45) 137 138... 139--- 140name: _ZN1BC2Ev 141alignment: 2 142tracksRegLiveness: true 143liveins: 144 - { reg: '$r0' } 145frameInfo: 146 stackSize: 8 147 maxAlignment: 4 148 adjustsStack: true 149 hasCalls: true 150 maxCallFrameSize: 0 151stack: 152 - { id: 0, type: spill-slot, offset: -4, size: 4, alignment: 4, stack-id: default, 153 callee-saved-register: '$lr', callee-saved-restored: false } 154 - { id: 1, type: spill-slot, offset: -8, size: 4, alignment: 4, stack-id: default, 155 callee-saved-register: '$r4' } 156body: | 157 bb.0.entry: 158 liveins: $r0, $r4, $lr 159 160 frame-setup tPUSH 14, $noreg, killed $r4, killed $lr, implicit-def $sp, implicit $sp 161 frame-setup CFI_INSTRUCTION def_cfa_offset 8 162 frame-setup CFI_INSTRUCTION offset $lr, -4 163 frame-setup CFI_INSTRUCTION offset $r4, -8 164 DBG_VALUE debug-use $r0, debug-use $noreg, !33, !DIExpression(), debug-location !35 165 $r4 = tMOVr $r0, 14, $noreg 166 DBG_VALUE debug-use $r4, debug-use $noreg, !33, !DIExpression(), debug-location !35 167 tBL 14, $noreg, @_ZN1AC2Ev, csr_ios, implicit-def dead $lr, implicit $sp, implicit killed $r0, implicit-def $sp, implicit-def dead $r0, debug-location !36 168 $r0 = t2MOVi16_ga_pcrel target-flags(arm-lo16, arm-nonlazy) @_ZTV1B, 0, debug-location !36 169 $r0 = t2MOVTi16_ga_pcrel killed $r0, target-flags(arm-hi16, arm-nonlazy) @_ZTV1B, 0, debug-location !36 170 $r0 = tPICADD killed $r0, 0, debug-location !36 171 renamable $r0 = tLDRi killed renamable $r0, 0, 14, $noreg, debug-location !36 :: (load 4 from got) 172 renamable $r0, dead $cpsr = nuw tADDi8 killed renamable $r0, 8, 14, $noreg, debug-location !36 173 tSTRi killed renamable $r0, renamable $r4, 0, 14, $noreg, debug-location !36 :: (store 4 into %ir.1, !tbaa !37) 174 $r0 = tMOVr killed $r4, 14, $noreg, debug-location !36 175 tPOP_RET 14, $noreg, def $r4, def $pc, implicit killed $r0, debug-location !36 176 177... 178--- 179name: _ZN1BC1Ev 180alignment: 2 181tracksRegLiveness: true 182liveins: 183 - { reg: '$r0' } 184frameInfo: 185 stackSize: 8 186 maxAlignment: 4 187 adjustsStack: true 188 hasCalls: true 189 maxCallFrameSize: 0 190stack: 191 - { id: 0, type: spill-slot, offset: -4, size: 4, alignment: 4, stack-id: default, 192 callee-saved-register: '$lr', callee-saved-restored: false } 193 - { id: 1, type: spill-slot, offset: -8, size: 4, alignment: 4, stack-id: default, 194 callee-saved-register: '$r4' } 195body: | 196 bb.0.entry: 197 liveins: $r0, $r4, $lr 198 199 frame-setup tPUSH 14, $noreg, killed $r4, killed $lr, implicit-def $sp, implicit $sp 200 frame-setup CFI_INSTRUCTION def_cfa_offset 8 201 frame-setup CFI_INSTRUCTION offset $lr, -4 202 frame-setup CFI_INSTRUCTION offset $r4, -8 203 DBG_VALUE debug-use $r0, debug-use $noreg, !42, !DIExpression(), debug-location !43 204 DBG_VALUE debug-use $r0, debug-use $noreg, !33, !DIExpression(), debug-location !44 205 $r4 = tMOVr $r0, 14, $noreg 206 DBG_VALUE debug-use $r4, debug-use $noreg, !33, !DIExpression(), debug-location !44 207 DBG_VALUE debug-use $r4, debug-use $noreg, !42, !DIExpression(), debug-location !43 208 tBL 14, $noreg, @_ZN1AC2Ev, csr_ios, implicit-def dead $lr, implicit $sp, implicit killed $r0, implicit-def $sp, implicit-def dead $r0, debug-location !46 209 $r0 = t2MOVi16_ga_pcrel target-flags(arm-lo16, arm-nonlazy) @_ZTV1B, 0, debug-location !46 210 $r0 = t2MOVTi16_ga_pcrel killed $r0, target-flags(arm-hi16, arm-nonlazy) @_ZTV1B, 0, debug-location !46 211 $r0 = tPICADD killed $r0, 0, debug-location !46 212 renamable $r0 = tLDRi killed renamable $r0, 0, 14, $noreg, debug-location !46 :: (load 4 from got) 213 renamable $r0, dead $cpsr = nuw tADDi8 killed renamable $r0, 8, 14, $noreg, debug-location !46 214 tSTRi killed renamable $r0, renamable $r4, 0, 14, $noreg, debug-location !46 :: (store 4 into %ir.1, !tbaa !37) 215 $r0 = tMOVr killed $r4, 14, $noreg, debug-location !45 216 tPOP_RET 14, $noreg, def $r4, def $pc, implicit killed $r0, debug-location !45 217 218... 219