251 lines · plain
1# RUN: llc -emit-call-site-info -start-before=aarch64-asm-printer -filetype=obj -o - %s \2# RUN: | llvm-dwarfdump -v - | FileCheck %s3 4# This tests for a crash in DwarfDebug's singular DBG_VALUE range promotion when5# encountering an IMPLICIT_DEF in its own lexical scope.6 7# CHECK: .debug_info contents:8# CHECK: DW_TAG_formal_parameter [14]9# CHECK-NEXT: DW_AT_const_value [DW_FORM_udata] (0)10# CHECK-NEXT: DW_AT_abstract_origin {{.*}} "name"11--- |12 ; ModuleID = 't.ll'13 source_filename = "t.ll"14 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"15 target triple = "aarch64--linux-gnu"16 17 %class.v = type <{ i32, i8, i8, [2 x i8] }>18 %class.j = type <{ %"class.j<6, a::f>::D", i32, [4 x i8] }>19 %"class.j<6, a::f>::D" = type { %"class.j<6, a::f>::p" }20 %"class.j<6, a::f>::p" = type { i64 }21 22 @bt = global i32 0, align 423 24 define void @_ZN1v2bvEv(ptr nocapture readonly %this) local_unnamed_addr align 2 !dbg !14 {25 entry:26 %bz = alloca %class.j, align 827 %att = alloca %class.j, align 828 %ap = getelementptr inbounds %class.v, ptr %this, i64 0, i32 129 %0 = load i8, ptr %ap, align 430 %conv = sext i8 %0 to i3231 switch i32 %conv, label %sw.epilog [32 i32 1, label %_ZN1jILi6EN1a1fEE1mEj.exit33 i32 0, label %sw.bb234 ]35 36 _ZN1jILi6EN1a1fEE1mEj.exit: ; preds = %entry37 %1 = bitcast ptr %att to ptr38 %2 = bitcast ptr %bz to ptr39 store i64 1, ptr %2, align 840 call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !18, metadata !23), !dbg !2441 store i64 1, ptr %1, align 8, !dbg !2742 br label %sw.epilog43 44 sw.bb2: ; preds = %entry45 %3 = bitcast ptr %att to ptr46 %4 = bitcast ptr %bz to ptr47 %.pre = load i64, ptr %3, align 848 %agg.tmp.sroa.2.0..sroa_idx1.i.i.i.i.i.i13.phi.trans.insert = getelementptr inbounds %class.j, ptr %bz, i64 0, i32 149 %.phi.trans.insert = bitcast ptr %agg.tmp.sroa.2.0..sroa_idx1.i.i.i.i.i.i13.phi.trans.insert to ptr50 %agg.tmp.sroa.2.0.copyload2.i.i6.i.i.i.i14.pre = load i64, ptr %.phi.trans.insert, align 851 %.pre25 = load i64, ptr %4, align 852 %agg.tmp.sroa.2.0..sroa_idx1.i.i.i.i.i.i.phi.trans.insert = getelementptr inbounds %class.j, ptr %att, i64 0, i32 153 %.phi.trans.insert26 = bitcast ptr %agg.tmp.sroa.2.0..sroa_idx1.i.i.i.i.i.i.phi.trans.insert to ptr54 %agg.tmp.sroa.2.0.copyload2.i.i6.i.i.i.i.pre = load i64, ptr %.phi.trans.insert26, align 855 br label %sw.epilog56 57 sw.epilog: ; preds = %sw.bb2, %_ZN1jILi6EN1a1fEE1mEj.exit, %entry58 %agg.tmp.sroa.2.0.copyload2.i.i6.i.i.i.i = phi i64 [ %agg.tmp.sroa.2.0.copyload2.i.i6.i.i.i.i.pre, %sw.bb2 ], [ undef, %entry ], [ undef, %_ZN1jILi6EN1a1fEE1mEj.exit ], !dbg !3259 %5 = phi i64 [ %.pre25, %sw.bb2 ], [ 0, %entry ], [ 1, %_ZN1jILi6EN1a1fEE1mEj.exit ]60 %agg.tmp.sroa.2.0.copyload2.i.i6.i.i.i.i14 = phi i64 [ %agg.tmp.sroa.2.0.copyload2.i.i6.i.i.i.i14.pre, %sw.bb2 ], [ undef, %entry ], [ undef, %_ZN1jILi6EN1a1fEE1mEj.exit ]61 %6 = phi i64 [ %.pre, %sw.bb2 ], [ 0, %entry ], [ 1, %_ZN1jILi6EN1a1fEE1mEj.exit ]62 %bw1 = bitcast ptr %this to ptr63 %7 = load i32, ptr %bw1, align 464 %bx = getelementptr inbounds %class.v, ptr %this, i64 0, i32 265 %8 = load i8, ptr %bx, align 166 %tobool = icmp ne i8 %8, 067 %.fca.0.insert9 = insertvalue [2 x i64] undef, i64 %agg.tmp.sroa.2.0.copyload2.i.i6.i.i.i.i14, 068 %.fca.1.insert12 = insertvalue [2 x i64] %.fca.0.insert9, i64 %5, 169 %.fca.0.insert = insertvalue [2 x i64] undef, i64 %agg.tmp.sroa.2.0.copyload2.i.i6.i.i.i.i, 070 %.fca.1.insert = insertvalue [2 x i64] %.fca.0.insert, i64 %6, 171 call void @_Z2byi1LS_bbPi(i32 %7, [2 x i64] %.fca.1.insert12, [2 x i64] %.fca.1.insert, i1 %tobool, i1 false, ptr nonnull @bt)72 ret void73 }74 75 declare void @_Z2byi1LS_bbPi(i32, [2 x i64], [2 x i64], i1, i1, ptr) local_unnamed_addr76 77 ; Function Attrs: nounwind readnone speculatable78 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #079 80 ; Function Attrs: nounwind81 declare void @llvm.stackprotector(ptr, ptr) #182 83 attributes #0 = { nounwind readnone speculatable }84 attributes #1 = { nounwind }85 86 !llvm.dbg.cu = !{!0}87 !llvm.module.flags = !{!12, !13}88 89 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 5.0.0 (trunk 305696) (llvm/trunk 305708)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, globals: !2)90 !1 = !DIFile(filename: "/<stdin>", directory: "/")91 !2 = !{}92 !3 = !{!4, !10}93 !4 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "r", file: !5, line: 50, size: 8, elements: !6, identifier: "_ZTS1r")94 !5 = !DIFile(filename: "current.ii", directory: "/")95 !6 = !{!7}96 !7 = !DISubprogram(name: "r", scope: !4, file: !5, line: 52, type: !8, isLocal: false, isDefinition: false, scopeLine: 52, flags: DIFlagPublic | DIFlagPrototyped, isOptimized: true)97 !8 = !DISubroutineType(types: !9)98 !9 = !{null}99 !10 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "q", scope: !11, file: !5, line: 39, size: 64, elements: !2, identifier: "_ZTSN1jILi6EN1a1fEE1qE")100 !11 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "j<6, a::f>", file: !5, line: 7, size: 128, elements: !2, templateParams: !2, identifier: "_ZTS1jILi6EN1a1fEE")101 !12 = !{i32 2, !"Debug Info Version", i32 3}102 !13 = !{i32 1, !"wchar_size", i32 4}103 !14 = distinct !DISubprogram(name: "bv", linkageName: "_ZN1v2bvEv", scope: !15, file: !5, line: 104, type: !16, isLocal: false, isDefinition: true, scopeLine: 104, flags: DIFlagPrototyped, isOptimized: true, unit: !0, declaration: !17, retainedNodes: !2)104 !15 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "v", file: !5, line: 97, size: 64, elements: !2, identifier: "_ZTS1v")105 !16 = !DISubroutineType(types: !2)106 !17 = !DISubprogram(name: "bv", linkageName: "_ZN1v2bvEv", scope: !15, file: !5, line: 98, type: !16, isLocal: false, isDefinition: false, scopeLine: 98, flags: DIFlagPrototyped, isOptimized: true)107 !18 = !DILocalVariable(name: "name", arg: 2, scope: !19, file: !5, line: 22, type: !21)108 !19 = distinct !DISubprogram(name: "m", linkageName: "_ZN1jILi6EN1a1fEE1mEj", scope: !11, file: !5, line: 22, type: !16, isLocal: false, isDefinition: true, scopeLine: 22, flags: DIFlagPrototyped, isOptimized: true, unit: !0, declaration: !20, retainedNodes: !2)109 !20 = !DISubprogram(name: "m", linkageName: "_ZN1jILi6EN1a1fEE1mEj", scope: !11, file: !5, line: 22, type: !16, isLocal: false, isDefinition: false, scopeLine: 22, flags: DIFlagPublic | DIFlagPrototyped, isOptimized: true)110 !21 = !DIDerivedType(tag: DW_TAG_typedef, name: "h", file: !5, line: 10, baseType: !22)111 !22 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned)112 !23 = !DIExpression()113 !24 = !DILocation(line: 22, scope: !19, inlinedAt: !25)114 !25 = distinct !DILocation(line: 109, scope: !26)115 !26 = distinct !DILexicalBlock(scope: !14, file: !5, line: 106)116 !27 = !DILocation(line: 29, scope: !28, inlinedAt: !31)117 !28 = distinct !DISubprogram(name: "n", linkageName: "_ZN1jILi6EN1a1fEE1p1nEl", scope: !29, file: !5, line: 29, type: !8, isLocal: false, isDefinition: true, scopeLine: 29, flags: DIFlagPrototyped, isOptimized: true, unit: !0, declaration: !30, retainedNodes: !2)118 !29 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "p", scope: !11, file: !5, line: 26, size: 64, elements: !2, identifier: "_ZTSN1jILi6EN1a1fEE1pE")119 !30 = !DISubprogram(name: "n", linkageName: "_ZN1jILi6EN1a1fEE1p1nEl", scope: !29, file: !5, line: 29, type: !8, isLocal: false, isDefinition: false, scopeLine: 29, flags: DIFlagPublic | DIFlagPrototyped, isOptimized: true)120 !31 = distinct !DILocation(line: 24, scope: !19, inlinedAt: !25)121 !32 = !DILocation(line: 61, scope: !33, inlinedAt: !38)122 !33 = distinct !DISubprogram(name: "bc<j<6, a::f> >", linkageName: "_ZN1s2bcI1jILi6EN1a1fEEEEDTcl2badeclsr1aE2aaIPT_EEEES6_", scope: !34, file: !5, line: 60, type: !16, isLocal: false, isDefinition: true, scopeLine: 60, flags: DIFlagPrototyped, isOptimized: true, unit: !0, templateParams: !36, declaration: !35, retainedNodes: !2)123 !34 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "s", file: !5, line: 59, size: 8, elements: !2, identifier: "_ZTS1s")124 !35 = !DISubprogram(name: "bc<j<6, a::f> >", linkageName: "_ZN1s2bcI1jILi6EN1a1fEEEEDTcl2badeclsr1aE2aaIPT_EEEES6_", scope: !34, file: !5, line: 60, type: !16, isLocal: false, isDefinition: false, scopeLine: 60, flags: DIFlagPrototyped, isOptimized: true, templateParams: !36)125 !36 = !{!37}126 !37 = !DITemplateTypeParameter(name: "ay", type: !11)127 !38 = distinct !DILocation(line: 70, scope: !39, inlinedAt: !42)128 !39 = distinct !DISubprogram(name: "bc", linkageName: "_ZN1JI1s1jILi6EN1a1fEEE2bcEPS4_", scope: !40, file: !5, line: 70, type: !16, isLocal: false, isDefinition: true, scopeLine: 70, flags: DIFlagPrototyped, isOptimized: true, unit: !0, declaration: !41, retainedNodes: !2)129 !40 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "J<s, j<6, a::f> >", file: !5, line: 69, size: 8, elements: !2, templateParams: !2, identifier: "_ZTS1JI1s1jILi6EN1a1fEEE")130 !41 = !DISubprogram(name: "bc", linkageName: "_ZN1JI1s1jILi6EN1a1fEEE2bcEPS4_", scope: !40, file: !5, line: 70, type: !16, isLocal: false, isDefinition: false, scopeLine: 70, flags: DIFlagPrototyped, isOptimized: true)131 !42 = distinct !DILocation(line: 85, scope: !43, inlinedAt: !46)132 !43 = distinct !DISubprogram(name: "u<j<6, a::f> >", linkageName: "_ZN1uC2I1jILi6EN1a1fEEEERT_", scope: !44, file: !5, line: 85, type: !16, isLocal: false, isDefinition: true, scopeLine: 85, flags: DIFlagPrototyped, isOptimized: true, unit: !0, templateParams: !36, declaration: !45, retainedNodes: !2)133 !44 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "u", file: !5, line: 82, size: 128, elements: !2, identifier: "_ZTS1u")134 !45 = !DISubprogram(name: "u<j<6, a::f> >", scope: !44, file: !5, line: 85, type: !16, isLocal: false, isDefinition: false, scopeLine: 85, flags: DIFlagPublic | DIFlagPrototyped, isOptimized: true, templateParams: !36)135 !46 = distinct !DILocation(line: 85, scope: !47, inlinedAt: !48)136 !47 = distinct !DISubprogram(name: "u<j<6, a::f> >", linkageName: "_ZN1uC1I1jILi6EN1a1fEEEERT_", scope: !44, file: !5, line: 85, type: !16, isLocal: false, isDefinition: true, scopeLine: 85, flags: DIFlagPrototyped, isOptimized: true, unit: !0, templateParams: !36, declaration: !45, retainedNodes: !2)137 !48 = distinct !DILocation(line: 92, scope: !49, inlinedAt: !52)138 !49 = distinct !DISubprogram(name: "L<j<6, a::f> >", linkageName: "_ZN1LC2I1jILi6EN1a1fEEEERT_", scope: !50, file: !5, line: 92, type: !16, isLocal: false, isDefinition: true, scopeLine: 92, flags: DIFlagPrototyped, isOptimized: true, unit: !0, templateParams: !2, declaration: !51, retainedNodes: !2)139 !50 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "L", file: !5, line: 88, size: 128, elements: !2, identifier: "_ZTS1L")140 !51 = !DISubprogram(name: "L<j<6, a::f> >", scope: !50, file: !5, line: 92, type: !16, isLocal: false, isDefinition: false, scopeLine: 92, flags: DIFlagPublic | DIFlagPrototyped, isOptimized: true, templateParams: !2)141 !52 = distinct !DILocation(line: 92, scope: !53, inlinedAt: !54)142 !53 = distinct !DISubprogram(name: "L<j<6, a::f> >", linkageName: "_ZN1LC1I1jILi6EN1a1fEEEERT_", scope: !50, file: !5, line: 92, type: !16, isLocal: false, isDefinition: true, scopeLine: 92, flags: DIFlagPrototyped, isOptimized: true, unit: !0, templateParams: !2, declaration: !51, retainedNodes: !2)143 !54 = distinct !DILocation(line: 114, scope: !14)144 145...146---147name: _ZN1v2bvEv148alignment: 4149exposesReturnsTwice: false150legalized: false151regBankSelected: false152selected: false153tracksRegLiveness: true154registers:155liveins:156 - { reg: '$x0', virtual-reg: '' }157frameInfo:158 isFrameAddressTaken: false159 isReturnAddressTaken: false160 hasStackMap: false161 hasPatchPoint: false162 stackSize: 48163 offsetAdjustment: 0164 maxAlignment: 16165 adjustsStack: true166 hasCalls: true167 stackProtector: ''168 maxCallFrameSize: 0169 hasOpaqueSPAdjustment: false170 hasVAStart: false171 hasMustTailInVarArgFunc: false172 savePoint: []173 restorePoint: []174fixedStack:175stack:176 - { id: 0, name: bz, type: default, offset: -32, size: 16, alignment: 8,177 callee-saved-register: '', local-offset: -16, debug-info-variable: '',178 debug-info-expression: '', debug-info-location: '' }179 - { id: 1, name: att, type: default, offset: -48, size: 16, alignment: 8,180 callee-saved-register: '', local-offset: -32, debug-info-variable: '',181 debug-info-expression: '', debug-info-location: '' }182 - { id: 2, name: '', type: spill-slot, offset: -16, size: 8, alignment: 16,183 callee-saved-register: '$lr', debug-info-variable: '',184 debug-info-expression: '', debug-info-location: '' }185constants:186body: |187 bb.0.entry:188 successors: %bb.3.sw.bb2(0x2aaaaaab), %bb.1.entry(0x55555555)189 liveins: $x0, $lr190 191 $sp = frame-setup SUBXri $sp, 48, 0192 frame-setup STRXui killed $lr, $sp, 4 :: (store (s64) into %stack.2)193 frame-setup CFI_INSTRUCTION def_cfa_offset 48194 frame-setup CFI_INSTRUCTION offset $w30, -16195 $w8 = LDRSBWui $x0, 4 :: (load (s8) from %ir.ap, align 4)196 CBZW $w8, %bb.3.sw.bb2197 198 bb.1.entry:199 successors: %bb.2._ZN1jILi6EN1a1fEE1mEj.exit(0x40000001), %bb.4(0x3fffffff)200 liveins: $w8, $x0201 202 dead $wzr = SUBSWri killed $w8, 1, 0, implicit-def $nzcv203 Bcc 1, %bb.4, implicit $nzcv204 205 bb.2._ZN1jILi6EN1a1fEE1mEj.exit:206 successors: %bb.5.sw.epilog(0x80000000)207 liveins: $x0208 209 $w2 = ORRWri $wzr, 0, implicit-def $x2210 $x3 = IMPLICIT_DEF debug-location !32211 $x1 = IMPLICIT_DEF212 STRXui $x2, $sp, 2 :: (store (s64) into %ir.2)213 DBG_VALUE 0, 0, !18, !23, debug-location !24214 STRXui $x2, $sp, 0, debug-location !27 :: (store (s64) into %ir.1)215 $w4 = ORRWri $wzr, 0, implicit-def $x4216 B %bb.5.sw.epilog217 218 bb.3.sw.bb2:219 successors: %bb.5.sw.epilog(0x80000000)220 liveins: $x0221 222 $x4, $x3 = LDPXi $sp, 0 :: (dereferenceable load (s64) from %ir.3), (dereferenceable load (s64) from %ir..phi.trans.insert26)223 $x2, $x1 = LDPXi $sp, 2 :: (dereferenceable load (s64) from %ir..phi.trans.insert), (dereferenceable load (s64) from %ir.4)224 B %bb.5.sw.epilog225 226 bb.4:227 successors: %bb.5.sw.epilog(0x80000000)228 liveins: $x0229 230 $x2 = ORRXrs $xzr, $xzr, 0231 $x4 = ORRXrs $xzr, $xzr, 0232 $x3 = IMPLICIT_DEF debug-location !32233 $x1 = IMPLICIT_DEF234 235 bb.5.sw.epilog:236 liveins: $x0, $x1, $x2, $x3, $x4237 238 $w8 = LDRBBui $x0, 5 :: (load (s8) from %ir.bx)239 $w0 = LDRWui killed $x0, 0 :: (load (s32) from %ir.bw1)240 $x7 = ADRP target-flags(aarch64-page) @bt241 $x7 = ADDXri killed $x7, target-flags(aarch64-pageoff, aarch64-nc) @bt, 0242 dead $wzr = SUBSWri killed $w8, 0, 0, implicit-def $nzcv243 $w5 = CSINCWr $wzr, $wzr, 0, implicit killed $nzcv244 $w6 = ORRWrs $wzr, $wzr, 0245 BL @_Z2byi1LS_bbPi, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit killed $x1, implicit killed $x2, implicit killed $x3, implicit killed $x4, implicit killed $w5, implicit killed $w6, implicit killed $x7, implicit-def $sp246 $lr = LDRXui $sp, 4 :: (load (s64) from %stack.2)247 $sp = ADDXri $sp, 48, 0248 RET undef $lr249 250...251