1; RUN: llc -filetype=obj -o - %s -experimental-debug-variable-locations=true | llvm-dwarfdump -debug-loc - | FileCheck %s 2 3; Note that it would be even better to avoid emitting the empty piece. 4; CHECK: {{.*}}: DW_OP_piece 0x8{{$}} 5 6source_filename = "bugpoint-reduced-simplified.ll" 7target triple = "i386-apple-ios7.0.0" 8 9%class.K = type { %class.N, %struct.F, i32 } 10%class.N = type { %struct.B } 11%struct.B = type { i8 } 12%struct.F = type { i8 } 13%struct.ConditionPlatformHelper = type { i8 } 14%"struct.J<K::L, false, int>::Node" = type { %"class.K::L" } 15%"class.K::L" = type { %class.__thread_id } 16%class.__thread_id = type { i32 } 17%"struct.K::M" = type { %class.I, %class.H } 18%class.I = type { i32 } 19%class.H = type { i32 } 20 21; Function Attrs: nounwind 22define void @_Z34swift_getGenericMetadata_argumentsv() #0 !dbg !5 { 23entry: 24 %ref.tmp = alloca %class.K, align 8 25 %call = tail call i64 @_Z8getCacheP23ConditionPlatformHelper(ptr undef) 26 %call.i.i = call ptr @_ZN1BIPN1JIN1K1LELb0EiE4NodeEE4loadEv(ptr nonnull %ref.tmp) 27 %tobool.i.i = icmp eq ptr %call.i.i, null 28 br i1 %tobool.i.i, label %_ZN1NIN1K1LELi0EE11getOrInsertIiEE1AIPS1_ET_.exit.i, label %if.then.i.i 29 30if.then.i.i: 31 %0 = lshr i64 %call, 32 32 %1 = trunc i64 %0 to i32 33 %Payload.i.i = getelementptr inbounds %"struct.J<K::L, false, int>::Node", ptr %call.i.i, i32 0, i32 0 34 br label %_ZN1NIN1K1LELi0EE11getOrInsertIiEE1AIPS1_ET_.exit.i 35 36_ZN1NIN1K1LELi0EE11getOrInsertIiEE1AIPS1_ET_.exit.i: ; preds = %if.then.i.i, %entry 37 %retval.sroa.0.0.i.i = phi ptr [ %Payload.i.i, %if.then.i.i ], [ undef, %entry ] 38 %call4.i = call ptr @_ZN1FIN1K1MEE3getEv(ptr undef) 39 call void @llvm.dbg.value(metadata ptr %call4.i, metadata !7, metadata !11), !dbg !12 40 call void @llvm.dbg.value(metadata ptr %call4.i, metadata !7, metadata !18), !dbg !12 41 %Handle.i.i.i.i.i = getelementptr inbounds %"struct.K::M", ptr %call4.i, i32 0, i32 1, i32 0 42 br label %while.body.i.i.i.i 43 44while.body.i.i.i.i: 45 %2 = load i32, ptr %retval.sroa.0.0.i.i, align 4 46 %call.i.i.i.i.i.i = call i32 @_Z6get_idv(), !dbg !12 47 %call.i.i.i.i.i.i.i = call zeroext i1 @_Z24__libcpp_thread_id_equalii(i32 %2, i32 %call.i.i.i.i.i.i) 48 %3 = load i32, ptr %call4.i, align 4 49 call void @_ZN23ConditionPlatformHelper4waitERii(ptr nonnull dereferenceable(4) %Handle.i.i.i.i.i, i32 %3) 50 br label %while.body.i.i.i.i 51} 52 53declare i64 @_Z8getCacheP23ConditionPlatformHelper(ptr) local_unnamed_addr 54 55declare ptr @_ZN1FIN1K1MEE3getEv(ptr) local_unnamed_addr 56 57declare ptr @_ZN1BIPN1JIN1K1LELb0EiE4NodeEE4loadEv(ptr) local_unnamed_addr 58 59declare i32 @_Z6get_idv() local_unnamed_addr 60 61declare zeroext i1 @_Z24__libcpp_thread_id_equalii(i32, i32) local_unnamed_addr 62 63declare void @_ZN23ConditionPlatformHelper4waitERii(ptr dereferenceable(4), i32) local_unnamed_addr 64 65; Function Attrs: nounwind readnone 66declare void @llvm.dbg.value(metadata, metadata, metadata) #1 67 68attributes #0 = { nounwind "frame-pointer"="non-leaf" } 69attributes #1 = { nounwind readnone } 70 71!llvm.dbg.cu = !{!0} 72!llvm.module.flags = !{!3, !4} 73 74!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 75!1 = !DIFile(filename: "test.ii", directory: "/") 76!2 = !{} 77!3 = !{i32 2, !"Dwarf Version", i32 2} 78!4 = !{i32 2, !"Debug Info Version", i32 3} 79!5 = distinct !DISubprogram(name: "swift_getGenericMetadata_arguments", linkageName: "_Z34swift_getGenericMetadata_argumentsv", scope: !0, file: !1, line: 95, type: !6, isLocal: false, isDefinition: true, scopeLine: 95, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !2) 80!6 = !DISubroutineType(types: !2) 81!7 = !DILocalVariable(name: "criticalSection", arg: 2, scope: !8, file: !1, line: 23, type: !10) 82!8 = distinct !DISubprogram(name: "<(lambda at test.ii:28:14)>", scope: !0, file: !1, line: 23, type: !6, isLocal: false, isDefinition: true, scopeLine: 23, flags: DIFlagPrototyped, isOptimized: true, unit: !0, templateParams: !2, declaration: !9, retainedNodes: !2) 83!9 = !DISubprogram(name: "<(lambda at test.ii:28:14)>", scope: !0, file: !1, line: 23, type: !6, isLocal: false, isDefinition: false, scopeLine: 23, flags: DIFlagPublic | DIFlagPrototyped, isOptimized: true, templateParams: !2) 84!10 = distinct !DICompositeType(tag: DW_TAG_class_type, scope: !0, file: !1, line: 28, size: 96, elements: !2) 85!11 = !DIExpression(DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 32) 86!12 = !DILocation(line: 23, column: 33, scope: !8, inlinedAt: !13) 87!13 = distinct !DILocation(line: 28, column: 5, scope: !14, inlinedAt: !16) 88!14 = distinct !DISubprogram(name: "<(lambda at test.ii:87:58)>", scope: !0, file: !1, line: 27, type: !6, isLocal: false, isDefinition: true, scopeLine: 27, flags: DIFlagPrototyped, isOptimized: true, unit: !0, templateParams: !2, declaration: !15, retainedNodes: !2) 89!15 = !DISubprogram(name: "<(lambda at test.ii:87:58)>", scope: !0, file: !1, line: 27, type: !6, isLocal: false, isDefinition: false, scopeLine: 27, flags: DIFlagPublic | DIFlagPrototyped, isOptimized: true, templateParams: !2) 90!16 = distinct !DILocation(line: 99, column: 21, scope: !17) 91!17 = !DILexicalBlockFile(scope: !5, file: !1, discriminator: 2) 92!18 = !DIExpression(DW_OP_plus_uconst, 4, DW_OP_stack_value, DW_OP_LLVM_fragment, 64, 32) 93