DI: Require subprogram definitions to be distinct
[oota-llvm.git] / test / DebugInfo / X86 / ending-run.ll
1 ; RUN: llc -mtriple=x86_64-apple-darwin -filetype=obj %s -o %t
2 ; RUN: llvm-dwarfdump -debug-dump=line %t | FileCheck %s
3
4 ; Check that the line table starts at 7, not 4, but that the first
5 ; statement isn't until line 8.
6
7 ; CHECK-NOT: 0x0000000000000000      7      0      1   0  0  is_stmt
8 ; CHECK: 0x0000000000000000      7      0      1   0
9 ; CHECK: 0x0000000000000004      8     18      1   0  0  is_stmt prologue_end
10
11 define i32 @callee(i32 %x) nounwind uwtable ssp {
12 entry:
13   %x.addr = alloca i32, align 4
14   %y = alloca i32, align 4
15   store i32 %x, i32* %x.addr, align 4
16   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
18   %0 = load i32, i32* %x.addr, align 4, !dbg !17
19   %1 = load i32, i32* %x.addr, align 4, !dbg !17
20   %mul = mul nsw i32 %0, %1, !dbg !17
21   store i32 %mul, i32* %y, align 4, !dbg !17
22   %2 = load i32, i32* %y, align 4, !dbg !18
23   %sub = sub nsw i32 %2, 2, !dbg !18
24   ret i32 %sub, !dbg !18
25 }
26
27 declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
28
29 !llvm.dbg.cu = !{!0}
30 !llvm.module.flags = !{!20}
31
32 !0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.1 (trunk 153921) (llvm/trunk 153916)", isOptimized: false, emissionKind: 0, file: !19, enums: !1, retainedTypes: !1, subprograms: !3, globals: !1, imports:  !1)
33 !1 = !{}
34 !3 = !{!5}
35 !5 = distinct !DISubprogram(name: "callee", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scopeLine: 7, file: !19, scope: !6, type: !7, function: i32 (i32)* @callee)
36 !6 = !DIFile(filename: "ending-run.c", directory: "/Users/echristo/tmp")
37 !7 = !DISubroutineType(types: !8)
38 !8 = !{!9, !9}
39 !9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
40 !12 = !DILocalVariable(name: "x", line: 5, arg: 1, scope: !5, file: !6, type: !9)
41 !13 = !DILocation(line: 5, column: 5, scope: !5)
42 !14 = !DILocalVariable(name: "y", line: 8, scope: !15, file: !6, type: !9)
43 !15 = distinct !DILexicalBlock(line: 7, column: 1, file: !19, scope: !5)
44 !16 = !DILocation(line: 8, column: 9, scope: !15)
45 !17 = !DILocation(line: 8, column: 18, scope: !15)
46 !18 = !DILocation(line: 9, column: 5, scope: !15)
47 !19 = !DIFile(filename: "ending-run.c", directory: "/Users/echristo/tmp")
48 !20 = !{i32 1, !"Debug Info Version", i32 3}