blob: 88826e0b06bcd3cd83a33cb2cfcbc3a9bd83f8a3 [file] [log] [blame]
Eric Christopher7790cf82014-03-26 23:10:28 +00001; RUN: llc -mtriple=x86_64-apple-darwin -filetype=obj %s -o %t
Eli Benderskye6abe832013-01-25 21:44:53 +00002; RUN: llvm-dwarfdump -debug-dump=line %t | FileCheck %s
Eric Christopherb81e2b42012-04-03 17:55:42 +00003
Eric Christopheraec8a822012-04-05 20:39:05 +00004; Check that the line table starts at 7, not 4, but that the first
5; statement isn't until line 8.
Eric Christopherb81e2b42012-04-03 17:55:42 +00006
Diego Novillo5b5cf502014-02-14 19:27:53 +00007; CHECK-NOT: 0x0000000000000000 7 0 1 0 0 is_stmt
Eric Christopheraec8a822012-04-05 20:39:05 +00008; CHECK: 0x0000000000000000 7 0 1 0
Diego Novillo5b5cf502014-02-14 19:27:53 +00009; CHECK: 0x0000000000000004 8 18 1 0 0 is_stmt prologue_end
Eric Christopherb81e2b42012-04-03 17:55:42 +000010
Peter Collingbourned4bff302015-11-05 22:03:56 +000011define i32 @callee(i32 %x) nounwind uwtable ssp !dbg !5 {
Eric Christopherb81e2b42012-04-03 17:55:42 +000012entry:
13 %x.addr = alloca i32, align 4
14 %y = alloca i32, align 4
15 store i32 %x, i32* %x.addr, align 4
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000016 call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !12, metadata !DIExpression()), !dbg !13
17 call void @llvm.dbg.declare(metadata i32* %y, metadata !14, metadata !DIExpression()), !dbg !16
David Blaikiea79ac142015-02-27 21:17:42 +000018 %0 = load i32, i32* %x.addr, align 4, !dbg !17
19 %1 = load i32, i32* %x.addr, align 4, !dbg !17
Eric Christopherb81e2b42012-04-03 17:55:42 +000020 %mul = mul nsw i32 %0, %1, !dbg !17
21 store i32 %mul, i32* %y, align 4, !dbg !17
David Blaikiea79ac142015-02-27 21:17:42 +000022 %2 = load i32, i32* %y, align 4, !dbg !18
Eric Christopherb81e2b42012-04-03 17:55:42 +000023 %sub = sub nsw i32 %2, 2, !dbg !18
24 ret i32 %sub, !dbg !18
25}
26
Adrian Prantl87b7eb92014-10-01 18:55:02 +000027declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
Eric Christopherb81e2b42012-04-03 17:55:42 +000028
29!llvm.dbg.cu = !{!0}
Manman Ren409558f2013-11-22 21:49:45 +000030!llvm.module.flags = !{!20}
Eric Christopherb81e2b42012-04-03 17:55:42 +000031
Adrian Prantl75819ae2016-04-15 15:57:41 +000032!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.1 (trunk 153921) (llvm/trunk 153916)", isOptimized: false, emissionKind: FullDebug, file: !19, enums: !1, retainedTypes: !1, globals: !1, imports: !1)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000033!1 = !{}
Adrian Prantl75819ae2016-04-15 15:57:41 +000034!5 = distinct !DISubprogram(name: "callee", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !0, scopeLine: 7, file: !19, scope: !6, type: !7)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000035!6 = !DIFile(filename: "ending-run.c", directory: "/Users/echristo/tmp")
36!7 = !DISubroutineType(types: !8)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000037!8 = !{!9, !9}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000038!9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +000039!12 = !DILocalVariable(name: "x", line: 5, arg: 1, scope: !5, file: !6, type: !9)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000040!13 = !DILocation(line: 5, column: 5, scope: !5)
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +000041!14 = !DILocalVariable(name: "y", line: 8, scope: !15, file: !6, type: !9)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000042!15 = distinct !DILexicalBlock(line: 7, column: 1, file: !19, scope: !5)
43!16 = !DILocation(line: 8, column: 9, scope: !15)
44!17 = !DILocation(line: 8, column: 18, scope: !15)
45!18 = !DILocation(line: 9, column: 5, scope: !15)
46!19 = !DIFile(filename: "ending-run.c", directory: "/Users/echristo/tmp")
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000047!20 = !{i32 1, !"Debug Info Version", i32 3}