97 lines · plain
1; RUN: llc -mtriple=x86_64-apple-darwin -O0 -filetype=obj -o %t < %s2; RUN: llvm-dwarfdump -v -debug-info %t | FileCheck %s3; <rdar://problem/12566646>4 5%struct.foo = type { i32, [1 x i32] }6%struct.bar = type { i32, [0 x i32] }7 8define i32 @func() nounwind uwtable ssp !dbg !5 {9entry:10 %my_foo = alloca %struct.foo, align 411 %my_bar = alloca %struct.bar, align 412 call void @llvm.dbg.declare(metadata ptr %my_foo, metadata !10, metadata !DIExpression()), !dbg !1913 call void @llvm.dbg.declare(metadata ptr %my_bar, metadata !20, metadata !DIExpression()), !dbg !2814 %a = getelementptr inbounds %struct.foo, ptr %my_foo, i32 0, i32 0, !dbg !2915 store i32 3, ptr %a, align 4, !dbg !2916 %a1 = getelementptr inbounds %struct.bar, ptr %my_bar, i32 0, i32 0, !dbg !3017 store i32 5, ptr %a1, align 4, !dbg !3018 %a2 = getelementptr inbounds %struct.foo, ptr %my_foo, i32 0, i32 0, !dbg !3119 %0 = load i32, ptr %a2, align 4, !dbg !3120 %a3 = getelementptr inbounds %struct.bar, ptr %my_bar, i32 0, i32 0, !dbg !3121 %1 = load i32, ptr %a3, align 4, !dbg !3122 %add = add nsw i32 %0, %1, !dbg !3123 ret i32 %add, !dbg !3124}25 26declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone27 28; CHECK: DW_TAG_base_type29; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[{{.*}}] = "int")30; CHECK-NEXT: DW_AT_encoding [DW_FORM_data1] (DW_ATE_signed)31; CHECK-NEXT: DW_AT_byte_size [DW_FORM_data1] (0x04)32 33; int foo::b[1]:34; CHECK: DW_TAG_structure_type35; CHECK: DW_AT_name{{.*}}"foo"36; CHECK: DW_TAG_member37; CHECK: DW_TAG_member38; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[{{.*}}] = "b")39; CHECK-NEXT: DW_AT_type [DW_FORM_ref4]40 41; int[1]:42; CHECK: DW_TAG_array_type [{{.*}}] *43; CHECK-NEXT: DW_AT_type [DW_FORM_ref4]44; CHECK: DW_TAG_subrange_type [{{.*}}]45; CHECK-NEXT: DW_AT_type [DW_FORM_ref4]46; CHECK-NEXT: DW_AT_count [DW_FORM_data1] (0x01)47 48; int bar::b[0]:49; CHECK: DW_TAG_structure_type50; CHECK: DW_AT_name{{.*}}"bar"51; CHECK: DW_TAG_member52; CHECK: DW_TAG_member53; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[{{.*}}] = "b")54; CHECK-NEXT: DW_AT_type [DW_FORM_ref4]55 56; int[0]:57; CHECK: DW_TAG_array_type [{{.*}}] *58; CHECK-NEXT: DW_AT_type [DW_FORM_ref4]59; CHECK: DW_TAG_subrange_type60; CHECK-NEXT: DW_AT_type [DW_FORM_ref4]61; CHECK: DW_AT_count [DW_FORM_data1] (0x00)62 63!llvm.dbg.cu = !{!0}64!llvm.module.flags = !{!33}65 66!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.3 (trunk 169136)", isOptimized: false, emissionKind: FullDebug, file: !32, enums: !1, retainedTypes: !1, globals: !1, imports: !1)67!1 = !{}68!5 = distinct !DISubprogram(name: "func", line: 11, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !0, scopeLine: 11, file: !6, scope: !6, type: !7, retainedNodes: !1)69!6 = !DIFile(filename: "test.c", directory: "/Volumes/Sandbox/llvm")70!7 = !DISubroutineType(types: !8)71!8 = !{!9}72!9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)73!10 = !DILocalVariable(name: "my_foo", line: 12, scope: !11, file: !6, type: !12)74!11 = distinct !DILexicalBlock(line: 11, column: 0, file: !6, scope: !5)75!12 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", line: 1, size: 64, align: 32, file: !32, elements: !13)76!13 = !{!14, !15}77!14 = !DIDerivedType(tag: DW_TAG_member, name: "a", line: 2, size: 32, align: 32, file: !32, scope: !12, baseType: !9)78!15 = !DIDerivedType(tag: DW_TAG_member, name: "b", line: 3, size: 32, align: 32, offset: 32, file: !32, scope: !12, baseType: !16)79!16 = !DICompositeType(tag: DW_TAG_array_type, size: 32, align: 32, baseType: !9, elements: !17)80!17 = !{!18}81!18 = !DISubrange(count: 1)82!19 = !DILocation(line: 12, scope: !11)83!20 = !DILocalVariable(name: "my_bar", line: 13, scope: !11, file: !6, type: !21)84!21 = !DICompositeType(tag: DW_TAG_structure_type, name: "bar", line: 6, size: 32, align: 32, file: !32, elements: !22)85!22 = !{!23, !24}86!23 = !DIDerivedType(tag: DW_TAG_member, name: "a", line: 7, size: 32, align: 32, file: !32, scope: !21, baseType: !9)87!24 = !DIDerivedType(tag: DW_TAG_member, name: "b", line: 8, align: 32, offset: 32, file: !32, scope: !21, baseType: !25)88!25 = !DICompositeType(tag: DW_TAG_array_type, align: 32, baseType: !9, elements: !26)89!26 = !{!27}90!27 = !DISubrange(count: 0)91!28 = !DILocation(line: 13, scope: !11)92!29 = !DILocation(line: 15, scope: !11)93!30 = !DILocation(line: 16, scope: !11)94!31 = !DILocation(line: 17, scope: !11)95!32 = !DIFile(filename: "test.c", directory: "/Volumes/Sandbox/llvm")96!33 = !{i32 1, !"Debug Info Version", i32 3}97