blob: a7a9bda000f10eb7fd1d2cb9d1c89918a7f6c26e [file] [log] [blame]
Manman Ren4e042a62013-02-05 21:52:47 +00001; RUN: llc -O0 %s -mtriple=x86_64-apple-darwin -filetype=obj -o %t
Adrian Prantl16aa4cf2017-09-11 23:05:20 +00002; RUN: llvm-dwarfdump -v %t | FileCheck %s
Eric Christopher33ff6972013-11-21 23:46:41 +00003; RUN: llc -O0 %s -mtriple=x86_64-apple-darwin -filetype=obj -o %t -dwarf-version=3
Adrian Prantl16aa4cf2017-09-11 23:05:20 +00004; RUN: llvm-dwarfdump -v %t | FileCheck %s -check-prefix=DWARF3
Manman Ren9d4c7352013-05-21 00:57:22 +00005; RUN: llc < %s -O0 -mtriple=x86_64-apple-macosx10.7 | FileCheck %s -check-prefix=ASM
Manman Ren4e042a62013-02-05 21:52:47 +00006
7; rdar://13067005
8; CHECK: .debug_info contents:
9; CHECK: DW_TAG_compile_unit
NAKAMURA Takumi17b73102013-12-30 09:26:10 +000010; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000)
Eric Christopher8873ada2014-01-29 22:22:56 +000011; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
Eric Christopher384f3fe2014-03-20 19:16:16 +000012; 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 Ren4e042a62013-02-05 21:52:47 +000016
17; CHECK: DW_TAG_compile_unit
Nico Weberc4d695e2016-12-16 14:02:28 +000018; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset] (0x0000003c)
Eric Christopher384f3fe2014-03-20 19:16:16 +000019; 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 Ren4e042a62013-02-05 21:52:47 +000025
26; CHECK: .debug_line contents:
Jonas Devlieghere65af0f92017-09-27 09:33:45 +000027; CHECK-NEXT: debug_line[0000000000000000]
Manman Ren4e042a62013-02-05 21:52:47 +000028; CHECK-NEXT: Line table prologue:
Nico Weberc4d695e2016-12-16 14:02:28 +000029; CHECK-NEXT: total_length: 0x00000038
Manman Ren1e427202013-03-07 01:42:00 +000030; CHECK: file_names[ 1] 0 0x00000000 0x00000000 simple.c
Jonas Devlieghere65af0f92017-09-27 09:33:45 +000031; CHECK: debug_line[000000000000003c]
32; CHECK-NEXT: Line table prologue:
Nico Weberc4d695e2016-12-16 14:02:28 +000033; CHECK-NEXT: total_length: 0x00000039
Manman Ren1e427202013-03-07 01:42:00 +000034; CHECK: file_names[ 1] 0 0x00000000 0x00000000 simple2.c
35; CHECK-NOT: file_names
Manman Ren4e042a62013-02-05 21:52:47 +000036
Eric Christopher33ff6972013-11-21 23:46:41 +000037; DWARF3: .debug_info contents:
38; DWARF3: DW_TAG_compile_unit
Eric Christopherfb8dd002014-01-29 22:06:27 +000039; DWARF3: DW_AT_stmt_list [DW_FORM_data4] (0x00000000)
Eric Christopher33ff6972013-11-21 23:46:41 +000040
41; DWARF3: DW_TAG_compile_unit
NAKAMURA Takumi17b73102013-12-30 09:26:10 +000042; DWARF3: DW_AT_stmt_list [DW_FORM_data4] (0x0000003c)
Eric Christopher384f3fe2014-03-20 19:16:16 +000043
Eric Christopher33ff6972013-11-21 23:46:41 +000044
45; DWARF3: .debug_line contents:
Jonas Devlieghere65af0f92017-09-27 09:33:45 +000046; DWARF3-NEXT: debug_line[0000000000000000]
Eric Christopher33ff6972013-11-21 23:46:41 +000047; DWARF3-NEXT: Line table prologue:
48; DWARF3-NEXT: total_length: 0x00000038
49; DWARF3: file_names[ 1] 0 0x00000000 0x00000000 simple.c
Jonas Devlieghere65af0f92017-09-27 09:33:45 +000050; DWARF3: debug_line[000000000000003c]
51; DWARF3-NEXT: Line table prologue:
Eric Christopher33ff6972013-11-21 23:46:41 +000052; DWARF3-NEXT: total_length: 0x00000039
53; DWARF3: file_names[ 1] 0 0x00000000 0x00000000 simple2.c
54; DWARF3-NOT: file_names
55
Manman Ren9d4c7352013-05-21 00:57:22 +000056; PR15408
Rafael Espindolafcc28212015-03-10 03:58:36 +000057; ASM: Lcu_begin0:
Duncan P. N. Exon Smith004e7342015-05-24 16:10:35 +000058; ASM-NOT: Lcu_begin
59; ASM: Lset[[LT:[0-9]+]] = Lline_table_start0-Lsection_line ## DW_AT_stmt_list
60; ASM-NEXT: .long Lset[[LT]]
Rafael Espindolafcc28212015-03-10 03:58:36 +000061; ASM: Lcu_begin1:
Duncan P. N. Exon Smith004e7342015-05-24 16:10:35 +000062; ASM-NOT: Lcu_begin
63; ASM: Lset[[LT:[0-9]+]] = Lline_table_start0-Lsection_line ## DW_AT_stmt_list
64; ASM-NEXT: .long Lset[[LT]]
Peter Collingbourned4bff302015-11-05 22:03:56 +000065define i32 @test(i32 %a) nounwind uwtable ssp !dbg !5 {
Manman Ren4e042a62013-02-05 21:52:47 +000066entry:
67 %a.addr = alloca i32, align 4
68 store i32 %a, i32* %a.addr, align 4
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000069 call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !15, metadata !DIExpression()), !dbg !16
David Blaikiea79ac142015-02-27 21:17:42 +000070 %0 = load i32, i32* %a.addr, align 4, !dbg !17
Manman Ren4e042a62013-02-05 21:52:47 +000071 %call = call i32 @fn(i32 %0), !dbg !17
72 ret i32 %call, !dbg !17
73}
74
Adrian Prantl87b7eb92014-10-01 18:55:02 +000075declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
Manman Ren4e042a62013-02-05 21:52:47 +000076
Peter Collingbourned4bff302015-11-05 22:03:56 +000077define i32 @fn(i32 %a) nounwind uwtable ssp !dbg !13 {
Manman Ren4e042a62013-02-05 21:52:47 +000078entry:
79 %a.addr = alloca i32, align 4
80 store i32 %a, i32* %a.addr, align 4
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000081 call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !19, metadata !DIExpression()), !dbg !20
David Blaikiea79ac142015-02-27 21:17:42 +000082 %0 = load i32, i32* %a.addr, align 4, !dbg !21
Manman Ren4e042a62013-02-05 21:52:47 +000083 ret i32 %0, !dbg !21
84}
85
86!llvm.dbg.cu = !{!0, !10}
Manman Ren409558f2013-11-22 21:49:45 +000087!llvm.module.flags = !{!25}
Adrian Prantl75819ae2016-04-15 15:57:41 +000088!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 Smithbe7ea192014-12-15 19:07:53 +000089!1 = !{}
Adrian Prantl75819ae2016-04-15 15:57:41 +000090!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, variables: !1)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000091!6 = !DIFile(filename: "simple.c", directory: "/private/tmp")
92!7 = !DISubroutineType(types: !8)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000093!8 = !{!9, !9}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000094!9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
Adrian Prantl75819ae2016-04-15 15:57:41 +000095!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)
96!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, variables: !1)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000097!14 = !DIFile(filename: "simple2.c", directory: "/private/tmp")
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +000098!15 = !DILocalVariable(name: "a", line: 2, arg: 1, scope: !5, file: !6, type: !9)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000099!16 = !DILocation(line: 2, scope: !5)
100!17 = !DILocation(line: 4, scope: !18)
101!18 = distinct !DILexicalBlock(line: 3, column: 0, file: !23, scope: !5)
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +0000102!19 = !DILocalVariable(name: "a", line: 1, arg: 1, scope: !13, file: !14, type: !9)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000103!20 = !DILocation(line: 1, scope: !13)
104!21 = !DILocation(line: 2, scope: !22)
105!22 = distinct !DILexicalBlock(line: 1, column: 0, file: !24, scope: !13)
106!23 = !DIFile(filename: "simple.c", directory: "/private/tmp")
107!24 = !DIFile(filename: "simple2.c", directory: "/private/tmp")
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +0000108!25 = !{i32 1, !"Debug Info Version", i32 3}