Manman Ren | 4e042a6 | 2013-02-05 21:52:47 +0000 | [diff] [blame] | 1 | ; RUN: llc -O0 %s -mtriple=x86_64-apple-darwin -filetype=obj -o %t |
Adrian Prantl | 16aa4cf | 2017-09-11 23:05:20 +0000 | [diff] [blame] | 2 | ; RUN: llvm-dwarfdump -v %t | FileCheck %s |
Eric Christopher | 33ff697 | 2013-11-21 23:46:41 +0000 | [diff] [blame] | 3 | ; RUN: llc -O0 %s -mtriple=x86_64-apple-darwin -filetype=obj -o %t -dwarf-version=3 |
Adrian Prantl | 16aa4cf | 2017-09-11 23:05:20 +0000 | [diff] [blame] | 4 | ; RUN: llvm-dwarfdump -v %t | FileCheck %s -check-prefix=DWARF3 |
Manman Ren | 9d4c735 | 2013-05-21 00:57:22 +0000 | [diff] [blame] | 5 | ; RUN: llc < %s -O0 -mtriple=x86_64-apple-macosx10.7 | FileCheck %s -check-prefix=ASM |
Manman Ren | 4e042a6 | 2013-02-05 21:52:47 +0000 | [diff] [blame] | 6 | |
| 7 | ; rdar://13067005 |
| 8 | ; CHECK: .debug_info contents: |
| 9 | ; CHECK: DW_TAG_compile_unit |
NAKAMURA Takumi | 17b7310 | 2013-12-30 09:26:10 +0000 | [diff] [blame] | 10 | ; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000) |
Eric Christopher | 8873ada | 2014-01-29 22:22:56 +0000 | [diff] [blame] | 11 | ; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000) |
Eric Christopher | 384f3fe | 2014-03-20 19:16:16 +0000 | [diff] [blame] | 12 | ; CHECK: DW_AT_high_pc [DW_FORM_data4] (0x00000010) |
| 13 | ; CHECK: DW_TAG_subprogram |
| 14 | ; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000) |
| 15 | ; CHECK: DW_AT_high_pc [DW_FORM_data4] (0x00000010) |
Manman Ren | 4e042a6 | 2013-02-05 21:52:47 +0000 | [diff] [blame] | 16 | |
| 17 | ; CHECK: DW_TAG_compile_unit |
Jonas Devlieghere | 64c901d | 2018-09-13 13:13:50 +0000 | [diff] [blame] | 18 | ; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset] (0x0000003d) |
Eric Christopher | 384f3fe | 2014-03-20 19:16:16 +0000 | [diff] [blame] | 19 | ; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000010) |
| 20 | ; CHECK: DW_AT_high_pc [DW_FORM_data4] (0x00000009) |
| 21 | ; CHECK: DW_TAG_subprogram |
| 22 | ; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000010) |
| 23 | ; CHECK: DW_AT_high_pc [DW_FORM_data4] (0x00000009) |
| 24 | |
Manman Ren | 4e042a6 | 2013-02-05 21:52:47 +0000 | [diff] [blame] | 25 | |
| 26 | ; CHECK: .debug_line contents: |
Jonas Devlieghere | 2bc4c54 | 2017-09-27 10:23:34 +0000 | [diff] [blame] | 27 | ; CHECK-NEXT: debug_line[{{.*}}] |
Manman Ren | 4e042a6 | 2013-02-05 21:52:47 +0000 | [diff] [blame] | 28 | ; CHECK-NEXT: Line table prologue: |
Jonas Devlieghere | 64c901d | 2018-09-13 13:13:50 +0000 | [diff] [blame] | 29 | ; CHECK-NEXT: total_length: 0x00000039 |
Scott Linder | 16c7bda | 2018-02-23 23:01:06 +0000 | [diff] [blame] | 30 | ; CHECK: file_names[ 1]: |
| 31 | ; CHECK-NEXT: name: "simple.c" |
| 32 | ; CHECK-NEXT: dir_index: 0 |
Jonas Devlieghere | 2bc4c54 | 2017-09-27 10:23:34 +0000 | [diff] [blame] | 33 | ; CHECK: debug_line[{{.*}}] |
Jonas Devlieghere | 65af0f9 | 2017-09-27 09:33:45 +0000 | [diff] [blame] | 34 | ; CHECK-NEXT: Line table prologue: |
Jonas Devlieghere | 64c901d | 2018-09-13 13:13:50 +0000 | [diff] [blame] | 35 | ; CHECK-NEXT: total_length: 0x0000003a |
Scott Linder | 16c7bda | 2018-02-23 23:01:06 +0000 | [diff] [blame] | 36 | ; CHECK: file_names[ 1]: |
| 37 | ; CHECK-NEXT: name: "simple2.c" |
| 38 | ; CHECK-NEXT: dir_index: 0 |
Manman Ren | 1e42720 | 2013-03-07 01:42:00 +0000 | [diff] [blame] | 39 | ; CHECK-NOT: file_names |
Manman Ren | 4e042a6 | 2013-02-05 21:52:47 +0000 | [diff] [blame] | 40 | |
Eric Christopher | 33ff697 | 2013-11-21 23:46:41 +0000 | [diff] [blame] | 41 | ; DWARF3: .debug_info contents: |
| 42 | ; DWARF3: DW_TAG_compile_unit |
Eric Christopher | fb8dd00 | 2014-01-29 22:06:27 +0000 | [diff] [blame] | 43 | ; DWARF3: DW_AT_stmt_list [DW_FORM_data4] (0x00000000) |
Eric Christopher | 33ff697 | 2013-11-21 23:46:41 +0000 | [diff] [blame] | 44 | |
| 45 | ; DWARF3: DW_TAG_compile_unit |
NAKAMURA Takumi | 17b7310 | 2013-12-30 09:26:10 +0000 | [diff] [blame] | 46 | ; DWARF3: DW_AT_stmt_list [DW_FORM_data4] (0x0000003c) |
Eric Christopher | 384f3fe | 2014-03-20 19:16:16 +0000 | [diff] [blame] | 47 | |
Eric Christopher | 33ff697 | 2013-11-21 23:46:41 +0000 | [diff] [blame] | 48 | |
| 49 | ; DWARF3: .debug_line contents: |
Jonas Devlieghere | 2bc4c54 | 2017-09-27 10:23:34 +0000 | [diff] [blame] | 50 | ; DWARF3-NEXT: debug_line[{{.*}}] |
Eric Christopher | 33ff697 | 2013-11-21 23:46:41 +0000 | [diff] [blame] | 51 | ; DWARF3-NEXT: Line table prologue: |
| 52 | ; DWARF3-NEXT: total_length: 0x00000038 |
Scott Linder | 16c7bda | 2018-02-23 23:01:06 +0000 | [diff] [blame] | 53 | ; DWARF3: file_names[ 1]: |
| 54 | ; DWARF3-NEXT: name: "simple.c" |
| 55 | ; DWARF3-NEXT: dir_index: 0 |
Jonas Devlieghere | 2bc4c54 | 2017-09-27 10:23:34 +0000 | [diff] [blame] | 56 | ; DWARF3: debug_line[{{.*}}] |
Jonas Devlieghere | 65af0f9 | 2017-09-27 09:33:45 +0000 | [diff] [blame] | 57 | ; DWARF3-NEXT: Line table prologue: |
Eric Christopher | 33ff697 | 2013-11-21 23:46:41 +0000 | [diff] [blame] | 58 | ; DWARF3-NEXT: total_length: 0x00000039 |
Scott Linder | 16c7bda | 2018-02-23 23:01:06 +0000 | [diff] [blame] | 59 | ; DWARF3: file_names[ 1]: |
| 60 | ; DWARF3-NEXT: name: "simple2.c" |
| 61 | ; DWARF3-NEXT: dir_index: 0 |
Eric Christopher | 33ff697 | 2013-11-21 23:46:41 +0000 | [diff] [blame] | 62 | ; DWARF3-NOT: file_names |
| 63 | |
Manman Ren | 9d4c735 | 2013-05-21 00:57:22 +0000 | [diff] [blame] | 64 | ; PR15408 |
Rafael Espindola | fcc2821 | 2015-03-10 03:58:36 +0000 | [diff] [blame] | 65 | ; ASM: Lcu_begin0: |
Duncan P. N. Exon Smith | 004e734 | 2015-05-24 16:10:35 +0000 | [diff] [blame] | 66 | ; ASM-NOT: Lcu_begin |
Krzysztof Parzyszek | 52396bb | 2018-03-27 16:44:41 +0000 | [diff] [blame] | 67 | ; ASM: .set Lset[[LT:[0-9]+]], Lline_table_start0-Lsection_line ## DW_AT_stmt_list |
Duncan P. N. Exon Smith | 004e734 | 2015-05-24 16:10:35 +0000 | [diff] [blame] | 68 | ; ASM-NEXT: .long Lset[[LT]] |
Rafael Espindola | fcc2821 | 2015-03-10 03:58:36 +0000 | [diff] [blame] | 69 | ; ASM: Lcu_begin1: |
Duncan P. N. Exon Smith | 004e734 | 2015-05-24 16:10:35 +0000 | [diff] [blame] | 70 | ; ASM-NOT: Lcu_begin |
Krzysztof Parzyszek | 52396bb | 2018-03-27 16:44:41 +0000 | [diff] [blame] | 71 | ; ASM: .set Lset[[LT:[0-9]+]], Lline_table_start0-Lsection_line ## DW_AT_stmt_list |
Duncan P. N. Exon Smith | 004e734 | 2015-05-24 16:10:35 +0000 | [diff] [blame] | 72 | ; ASM-NEXT: .long Lset[[LT]] |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame] | 73 | define i32 @test(i32 %a) nounwind uwtable ssp !dbg !5 { |
Manman Ren | 4e042a6 | 2013-02-05 21:52:47 +0000 | [diff] [blame] | 74 | entry: |
| 75 | %a.addr = alloca i32, align 4 |
| 76 | store i32 %a, i32* %a.addr, align 4 |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 77 | call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !15, metadata !DIExpression()), !dbg !16 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 78 | %0 = load i32, i32* %a.addr, align 4, !dbg !17 |
Manman Ren | 4e042a6 | 2013-02-05 21:52:47 +0000 | [diff] [blame] | 79 | %call = call i32 @fn(i32 %0), !dbg !17 |
| 80 | ret i32 %call, !dbg !17 |
| 81 | } |
| 82 | |
Adrian Prantl | 87b7eb9 | 2014-10-01 18:55:02 +0000 | [diff] [blame] | 83 | declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone |
Manman Ren | 4e042a6 | 2013-02-05 21:52:47 +0000 | [diff] [blame] | 84 | |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame] | 85 | define i32 @fn(i32 %a) nounwind uwtable ssp !dbg !13 { |
Manman Ren | 4e042a6 | 2013-02-05 21:52:47 +0000 | [diff] [blame] | 86 | entry: |
| 87 | %a.addr = alloca i32, align 4 |
| 88 | store i32 %a, i32* %a.addr, align 4 |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 89 | call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !19, metadata !DIExpression()), !dbg !20 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 90 | %0 = load i32, i32* %a.addr, align 4, !dbg !21 |
Manman Ren | 4e042a6 | 2013-02-05 21:52:47 +0000 | [diff] [blame] | 91 | ret i32 %0, !dbg !21 |
| 92 | } |
| 93 | |
| 94 | !llvm.dbg.cu = !{!0, !10} |
Manman Ren | 409558f | 2013-11-22 21:49:45 +0000 | [diff] [blame] | 95 | !llvm.module.flags = !{!25} |
Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame] | 96 | !0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.3", isOptimized: false, emissionKind: FullDebug, file: !23, enums: !1, retainedTypes: !1, globals: !1, imports: !1) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 97 | !1 = !{} |
Shiva Chen | 2c86455 | 2018-05-09 02:40:45 +0000 | [diff] [blame] | 98 | !5 = distinct !DISubprogram(name: "test", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 3, file: !23, scope: !6, type: !7, retainedNodes: !1) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 99 | !6 = !DIFile(filename: "simple.c", directory: "/private/tmp") |
| 100 | !7 = !DISubroutineType(types: !8) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 101 | !8 = !{!9, !9} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 102 | !9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame] | 103 | !10 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.3 (trunk 172862)", isOptimized: false, emissionKind: FullDebug, file: !24, enums: !1, retainedTypes: !1, globals: !1, imports: !1) |
Shiva Chen | 2c86455 | 2018-05-09 02:40:45 +0000 | [diff] [blame] | 104 | !13 = distinct !DISubprogram(name: "fn", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !10, scopeLine: 1, file: !24, scope: !14, type: !7, retainedNodes: !1) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 105 | !14 = !DIFile(filename: "simple2.c", directory: "/private/tmp") |
Duncan P. N. Exon Smith | ed013cd | 2015-07-31 18:58:39 +0000 | [diff] [blame] | 106 | !15 = !DILocalVariable(name: "a", line: 2, arg: 1, scope: !5, file: !6, type: !9) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 107 | !16 = !DILocation(line: 2, scope: !5) |
| 108 | !17 = !DILocation(line: 4, scope: !18) |
| 109 | !18 = distinct !DILexicalBlock(line: 3, column: 0, file: !23, scope: !5) |
Duncan P. N. Exon Smith | ed013cd | 2015-07-31 18:58:39 +0000 | [diff] [blame] | 110 | !19 = !DILocalVariable(name: "a", line: 1, arg: 1, scope: !13, file: !14, type: !9) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 111 | !20 = !DILocation(line: 1, scope: !13) |
| 112 | !21 = !DILocation(line: 2, scope: !22) |
| 113 | !22 = distinct !DILexicalBlock(line: 1, column: 0, file: !24, scope: !13) |
| 114 | !23 = !DIFile(filename: "simple.c", directory: "/private/tmp") |
| 115 | !24 = !DIFile(filename: "simple2.c", directory: "/private/tmp") |
Duncan P. N. Exon Smith | e274180 | 2015-03-03 17:24:31 +0000 | [diff] [blame] | 116 | !25 = !{i32 1, !"Debug Info Version", i32 3} |