| Bill Wendling | bfc0e57 | 2012-12-04 06:20:49 +0000 | [diff] [blame] | 1 | ; RUN: llc -mtriple=x86_64-apple-darwin -O0 -filetype=obj -o %t < %s |
| Eli Bendersky | e6abe83 | 2013-01-25 21:44:53 +0000 | [diff] [blame] | 2 | ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s |
| Bill Wendling | bfc0e57 | 2012-12-04 06:20:49 +0000 | [diff] [blame] | 3 | ; <rdar://problem/12566646> |
| 4 | |
| 5 | %struct.foo = type { i32, [1 x i32] } |
| 6 | %struct.bar = type { i32, [0 x i32] } |
| 7 | |
| 8 | define i32 @func() nounwind uwtable ssp { |
| 9 | entry: |
| 10 | %my_foo = alloca %struct.foo, align 4 |
| 11 | %my_bar = alloca %struct.bar, align 4 |
| Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 12 | call void @llvm.dbg.declare(metadata %struct.foo* %my_foo, metadata !10, metadata !{!"0x102"}), !dbg !19 |
| 13 | call void @llvm.dbg.declare(metadata %struct.bar* %my_bar, metadata !20, metadata !{!"0x102"}), !dbg !28 |
| Bill Wendling | bfc0e57 | 2012-12-04 06:20:49 +0000 | [diff] [blame] | 14 | %a = getelementptr inbounds %struct.foo* %my_foo, i32 0, i32 0, !dbg !29 |
| 15 | store i32 3, i32* %a, align 4, !dbg !29 |
| 16 | %a1 = getelementptr inbounds %struct.bar* %my_bar, i32 0, i32 0, !dbg !30 |
| 17 | store i32 5, i32* %a1, align 4, !dbg !30 |
| 18 | %a2 = getelementptr inbounds %struct.foo* %my_foo, i32 0, i32 0, !dbg !31 |
| 19 | %0 = load i32* %a2, align 4, !dbg !31 |
| 20 | %a3 = getelementptr inbounds %struct.bar* %my_bar, i32 0, i32 0, !dbg !31 |
| 21 | %1 = load i32* %a3, align 4, !dbg !31 |
| 22 | %add = add nsw i32 %0, %1, !dbg !31 |
| 23 | ret i32 %add, !dbg !31 |
| 24 | } |
| 25 | |
| Adrian Prantl | 87b7eb9 | 2014-10-01 18:55:02 +0000 | [diff] [blame] | 26 | declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone |
| Bill Wendling | bfc0e57 | 2012-12-04 06:20:49 +0000 | [diff] [blame] | 27 | |
| David Blaikie | eb1a272 | 2014-06-13 22:18:23 +0000 | [diff] [blame] | 28 | ; CHECK: DW_TAG_base_type |
| 29 | ; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[{{.*}}] = "int") |
| Frederic Riss | 878065b | 2014-09-04 19:39:20 +0000 | [diff] [blame] | 30 | ; CHECK-NEXT: DW_AT_encoding [DW_FORM_data1] (DW_ATE_signed) |
| David Blaikie | eb1a272 | 2014-06-13 22:18:23 +0000 | [diff] [blame] | 31 | ; CHECK-NEXT: DW_AT_byte_size [DW_FORM_data1] (0x04) |
| 32 | |
| Manman Ren | f4c339e | 2013-10-29 22:49:29 +0000 | [diff] [blame] | 33 | ; int foo::b[1]: |
| 34 | ; CHECK: DW_TAG_structure_type |
| 35 | ; CHECK: DW_AT_name{{.*}}"foo" |
| 36 | ; CHECK: DW_TAG_member |
| 37 | ; CHECK: DW_TAG_member |
| 38 | ; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[{{.*}}] = "b") |
| Eric Christopher | e31e072 | 2013-09-04 22:21:24 +0000 | [diff] [blame] | 39 | ; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] |
| Manman Ren | f4c339e | 2013-10-29 22:49:29 +0000 | [diff] [blame] | 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 [{{.*}}] |
| Eric Christopher | e31e072 | 2013-09-04 22:21:24 +0000 | [diff] [blame] | 45 | ; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] |
| David Blaikie | 32b0f36 | 2014-10-01 00:56:55 +0000 | [diff] [blame] | 46 | ; CHECK-NEXT: DW_AT_count [DW_FORM_data1] (0x01) |
| Bill Wendling | bfc0e57 | 2012-12-04 06:20:49 +0000 | [diff] [blame] | 47 | |
| Manman Ren | f4c339e | 2013-10-29 22:49:29 +0000 | [diff] [blame] | 48 | ; int bar::b[0]: |
| 49 | ; CHECK: DW_TAG_structure_type |
| 50 | ; CHECK: DW_AT_name{{.*}}"bar" |
| 51 | ; CHECK: DW_TAG_member |
| 52 | ; CHECK: DW_TAG_member |
| Eric Christopher | e31e072 | 2013-09-04 22:21:24 +0000 | [diff] [blame] | 53 | ; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[{{.*}}] = "b") |
| 54 | ; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] |
| Bill Wendling | bfc0e57 | 2012-12-04 06:20:49 +0000 | [diff] [blame] | 55 | |
| 56 | ; int[0]: |
| Manman Ren | f4c339e | 2013-10-29 22:49:29 +0000 | [diff] [blame] | 57 | ; CHECK: DW_TAG_array_type [{{.*}}] * |
| Eric Christopher | e31e072 | 2013-09-04 22:21:24 +0000 | [diff] [blame] | 58 | ; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] |
| David Blaikie | 32b0f36 | 2014-10-01 00:56:55 +0000 | [diff] [blame] | 59 | ; CHECK: DW_TAG_subrange_type |
| Eric Christopher | e31e072 | 2013-09-04 22:21:24 +0000 | [diff] [blame] | 60 | ; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] |
| David Blaikie | 32b0f36 | 2014-10-01 00:56:55 +0000 | [diff] [blame] | 61 | ; CHECK: DW_AT_count [DW_FORM_data1] (0x00) |
| Bill Wendling | bfc0e57 | 2012-12-04 06:20:49 +0000 | [diff] [blame] | 62 | |
| Bill Wendling | bfc0e57 | 2012-12-04 06:20:49 +0000 | [diff] [blame] | 63 | !llvm.dbg.cu = !{!0} |
| Manman Ren | 409558f | 2013-11-22 21:49:45 +0000 | [diff] [blame] | 64 | !llvm.module.flags = !{!33} |
| Bill Wendling | bfc0e57 | 2012-12-04 06:20:49 +0000 | [diff] [blame] | 65 | |
| Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 66 | !0 = !{!"0x11\0012\00clang version 3.3 (trunk 169136)\000\00\000\00\000", !32, !1, !1, !3, !1, !1} ; [ DW_TAG_compile_unit ] [/Volumes/Sandbox/llvm/test.c] [DW_LANG_C99] |
| 67 | !1 = !{} |
| 68 | !3 = !{!5} |
| 69 | !5 = !{!"0x2e\00func\00func\00\0011\000\001\000\006\000\000\0011", !6, !6, !7, null, i32 ()* @func, null, null, !1} ; [ DW_TAG_subprogram ] [line 11] [def] [func] |
| 70 | !6 = !{!"0x29", !32} ; [ DW_TAG_file_type ] |
| 71 | !7 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !8, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] |
| 72 | !8 = !{!9} |
| 73 | !9 = !{!"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed] |
| 74 | !10 = !{!"0x100\00my_foo\0012\000", !11, !6, !12} ; [ DW_TAG_auto_variable ] [my_foo] [line 12] |
| 75 | !11 = !{!"0xb\0011\000\000", !6, !5} ; [ DW_TAG_lexical_block ] [/Volumes/Sandbox/llvm/test.c] |
| 76 | !12 = !{!"0x13\00foo\001\0064\0032\000\000\000", !32, null, null, !13, null, i32 0, null} ; [ DW_TAG_structure_type ] [foo] [line 1, size 64, align 32, offset 0] [def] [from ] |
| 77 | !13 = !{!14, !15} |
| 78 | !14 = !{!"0xd\00a\002\0032\0032\000\000", !32, !12, !9} ; [ DW_TAG_member ] [a] [line 2, size 32, align 32, offset 0] [from int] |
| 79 | !15 = !{!"0xd\00b\003\0032\0032\0032\000", !32, !12, !16} ; [ DW_TAG_member ] [b] [line 3, size 32, align 32, offset 32] [from ] |
| 80 | !16 = !{!"0x1\00\000\0032\0032\000\000", null, null, !9, !17, i32 0, null, null, null} ; [ DW_TAG_array_type ] [line 0, size 32, align 32, offset 0] [from int] |
| 81 | !17 = !{!18} |
| 82 | !18 = !{!"0x21\000\001"} ; [ DW_TAG_subrange_type ] [0, 1] |
| Duncan P. N. Exon Smith | 9885469 | 2015-01-14 22:27:36 +0000 | [diff] [blame^] | 83 | !19 = !MDLocation(line: 12, scope: !11) |
| Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 84 | !20 = !{!"0x100\00my_bar\0013\000", !11, !6, !21} ; [ DW_TAG_auto_variable ] [my_bar] [line 13] |
| 85 | !21 = !{!"0x13\00bar\006\0032\0032\000\000\000", !32, null, null, !22, null, i32 0, null} ; [ DW_TAG_structure_type ] [bar] [line 6, size 32, align 32, offset 0] [def] [from ] |
| 86 | !22 = !{!23, !24} |
| 87 | !23 = !{!"0xd\00a\007\0032\0032\000\000", !32, !21, !9} ; [ DW_TAG_member ] [a] [line 7, size 32, align 32, offset 0] [from int] |
| 88 | !24 = !{!"0xd\00b\008\000\0032\0032\000", !32, !21, !25} ; [ DW_TAG_member ] [b] [line 8, size 0, align 32, offset 32] [from ] |
| 89 | !25 = !{!"0x1\00\000\000\0032\000\000", null, null, !9, !26, i32 0, null, null, null} ; [ DW_TAG_array_type ] [line 0, size 0, align 32, offset 0] [from int] |
| 90 | !26 = !{!27} |
| 91 | !27 = !{!"0x21\000\000"} ; [ DW_TAG_subrange_type ] [0, 0] |
| Duncan P. N. Exon Smith | 9885469 | 2015-01-14 22:27:36 +0000 | [diff] [blame^] | 92 | !28 = !MDLocation(line: 13, scope: !11) |
| 93 | !29 = !MDLocation(line: 15, scope: !11) |
| 94 | !30 = !MDLocation(line: 16, scope: !11) |
| 95 | !31 = !MDLocation(line: 17, scope: !11) |
| Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 96 | !32 = !{!"test.c", !"/Volumes/Sandbox/llvm"} |
| 97 | !33 = !{i32 1, !"Debug Info Version", i32 2} |