DI: Require subprogram definitions to be distinct
[oota-llvm.git] / test / DebugInfo / X86 / frame-register.ll
1 ; RUN: llc %s -filetype=obj -o - | llvm-dwarfdump --debug-dump=info - | FileCheck %s
2 ; CHECK: DW_TAG_variable
3 ;                                                      DW_OP_fbreg
4 ; CHECK-NEXT: DW_AT_location [DW_FORM_exprloc]      (<0x2> 91 00 )
5 ; CHECK-NEXT: DW_AT_name {{.*}}"i"
6
7 target datalayout = "e-m:e-p:32:32-i64:64-f80:128-n8:16:32:64-S128"
8 target triple = "x86_64-apple-darwin"
9
10 ; Function Attrs: nounwind uwtable
11 declare i32 @foo(i32 %i) #0
12
13 ; Function Attrs: nounwind readnone
14 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
15
16 ; Function Attrs: nounwind uwtable
17 define i32 @main() #0 {
18 entry:
19   %retval = alloca i32, align 4
20   %i = alloca i32, align 4
21   store i32 0, i32* %retval
22   call void @llvm.dbg.declare(metadata i32* %i, metadata !20, metadata !16), !dbg !21
23   store i32 20, i32* %i, align 4, !dbg !21
24   %0 = load i32, i32* %i, align 4, !dbg !22
25   %call = call i32 @foo(i32 %0), !dbg !23
26   ret i32 %call, !dbg !24
27 }
28
29 attributes #0 = { nounwind uwtable  }
30 attributes #1 = { nounwind readnone }
31
32 !llvm.dbg.cu = !{!0}
33 !llvm.module.flags = !{!12, !13}
34 !llvm.ident = !{!14}
35
36 !0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.7.0", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2)
37 !1 = !DIFile(filename: "x.c", directory: "")
38 !2 = !{}
39 !3 = !{!4, !9}
40 !4 = distinct !DISubprogram(name: "foo", line: 2, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !1, scope: !5, type: !6, function: i32 (i32)* @foo, variables: !2)
41 !5 = !DIFile(filename: "x.c", directory: "")
42 !6 = !DISubroutineType(types: !7)
43 !7 = !{!8, !8}
44 !8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
45 !9 = distinct !DISubprogram(name: "main", line: 8, isLocal: false, isDefinition: true, isOptimized: false, scopeLine: 9, file: !1, scope: !5, type: !10, function: i32 ()* @main, variables: !2)
46 !10 = !DISubroutineType(types: !11)
47 !11 = !{!8}
48 !12 = !{i32 2, !"Dwarf Version", i32 4}
49 !13 = !{i32 2, !"Debug Info Version", i32 3}
50 !14 = !{!"clang version 3.7.0"}
51 !15 = !DILocalVariable(name: "i", line: 2, arg: 1, scope: !4, file: !5, type: !8)
52 !16 = !DIExpression()
53 !17 = !DILocation(line: 2, column: 10, scope: !4)
54 !18 = !DILocation(line: 4, column: 10, scope: !4)
55 !19 = !DILocation(line: 4, column: 3, scope: !4)
56 !20 = !DILocalVariable(name: "i", line: 10, scope: !9, file: !5, type: !8)
57 !21 = !DILocation(line: 10, column: 7, scope: !9)
58 !22 = !DILocation(line: 11, column: 15, scope: !9)
59 !23 = !DILocation(line: 11, column: 10, scope: !9)
60 !24 = !DILocation(line: 11, column: 3, scope: !9)