Temporarily revert r257105 "[Verifier] Check that debug values have proper size"
[oota-llvm.git] / test / DebugInfo / X86 / elf-names.ll
1 ; RUN: llc -mtriple=x86_64-unknown-linux-gnu %s -o %t -filetype=obj
2 ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
3 ; RUN: llvm-as < %s | llvm-dis | FileCheck --check-prefix=CHECK-DIS %s
4
5 ; CHECK: 0x0000000b: DW_TAG_compile_unit
6 ; CHECK:               DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000035] = "foo.cpp")
7 ; CHECK: 0x{{[0-9a-f]+}}:   DW_TAG_class_type
8 ; CHECK:                 DW_AT_name [DW_FORM_strp]       ( .debug_str[0x{{[0-9a-f]+}}] = "D")
9 ; CHECK: 0x{{[0-9a-f]+}}:     DW_TAG_member
10 ; CHECK:                   DW_AT_name [DW_FORM_strp]     ( .debug_str[0x{{[0-9a-f]+}}] = "c1")
11 ; CHECK: DW_TAG_subprogram
12 ; CHECK-NEXT: DW_AT_name [DW_FORM_strp]     ( .debug_str[0x{{[0-9a-f]+}}] = "D")
13 ; CHECK: DW_TAG_formal_parameter
14 ; CHECK: DW_AT_artificial [DW_FORM_flag_present]       (true)
15
16 ; CHECK-DIS: DIFlagArtificial
17
18 %class.D = type { i32, i32, i32, i32 }
19
20 @_ZN1DC1Ev = alias void (%class.D*), void (%class.D*)* @_ZN1DC2Ev
21 @_ZN1DC1ERKS_ = alias void (%class.D*, %class.D*), void (%class.D*, %class.D*)* @_ZN1DC2ERKS_
22
23 define void @_ZN1DC2Ev(%class.D* nocapture %this) unnamed_addr nounwind uwtable align 2 !dbg !5 {
24 entry:
25   tail call void @llvm.dbg.value(metadata %class.D* %this, i64 0, metadata !29, metadata !DIExpression()), !dbg !36
26   %c1 = getelementptr inbounds %class.D, %class.D* %this, i64 0, i32 0, !dbg !37
27   store i32 1, i32* %c1, align 4, !dbg !37
28   %c2 = getelementptr inbounds %class.D, %class.D* %this, i64 0, i32 1, !dbg !42
29   store i32 2, i32* %c2, align 4, !dbg !42
30   %c3 = getelementptr inbounds %class.D, %class.D* %this, i64 0, i32 2, !dbg !43
31   store i32 3, i32* %c3, align 4, !dbg !43
32   %c4 = getelementptr inbounds %class.D, %class.D* %this, i64 0, i32 3, !dbg !44
33   store i32 4, i32* %c4, align 4, !dbg !44
34   ret void, !dbg !45
35 }
36
37 define void @_ZN1DC2ERKS_(%class.D* nocapture %this, %class.D* nocapture %d) unnamed_addr nounwind uwtable align 2 !dbg !31 {
38 entry:
39   tail call void @llvm.dbg.value(metadata %class.D* %this, i64 0, metadata !34, metadata !DIExpression()), !dbg !46
40   tail call void @llvm.dbg.value(metadata %class.D* %d, i64 0, metadata !35, metadata !DIExpression()), !dbg !46
41   %c1 = getelementptr inbounds %class.D, %class.D* %d, i64 0, i32 0, !dbg !47
42   %0 = load i32, i32* %c1, align 4, !dbg !47
43   %c12 = getelementptr inbounds %class.D, %class.D* %this, i64 0, i32 0, !dbg !47
44   store i32 %0, i32* %c12, align 4, !dbg !47
45   %c2 = getelementptr inbounds %class.D, %class.D* %d, i64 0, i32 1, !dbg !49
46   %1 = load i32, i32* %c2, align 4, !dbg !49
47   %c23 = getelementptr inbounds %class.D, %class.D* %this, i64 0, i32 1, !dbg !49
48   store i32 %1, i32* %c23, align 4, !dbg !49
49   %c3 = getelementptr inbounds %class.D, %class.D* %d, i64 0, i32 2, !dbg !50
50   %2 = load i32, i32* %c3, align 4, !dbg !50
51   %c34 = getelementptr inbounds %class.D, %class.D* %this, i64 0, i32 2, !dbg !50
52   store i32 %2, i32* %c34, align 4, !dbg !50
53   %c4 = getelementptr inbounds %class.D, %class.D* %d, i64 0, i32 3, !dbg !51
54   %3 = load i32, i32* %c4, align 4, !dbg !51
55   %c45 = getelementptr inbounds %class.D, %class.D* %this, i64 0, i32 3, !dbg !51
56   store i32 %3, i32* %c45, align 4, !dbg !51
57   ret void, !dbg !52
58 }
59
60 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
61
62 !llvm.dbg.cu = !{!0}
63 !llvm.module.flags = !{!54}
64
65 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.2 (trunk 167506) (llvm/trunk 167505)", isOptimized: true, emissionKind: 0, file: !53, enums: !1, retainedTypes: !1, subprograms: !3, globals: !1, imports:  !1)
66 !1 = !{}
67 !3 = !{!5, !31}
68 !5 = distinct !DISubprogram(name: "D", linkageName: "_ZN1DC2Ev", line: 12, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 12, file: !6, scope: null, type: !7, declaration: !17, variables: !27)
69 !6 = !DIFile(filename: "foo.cpp", directory: "/usr/local/google/home/echristo")
70 !7 = !DISubroutineType(types: !8)
71 !8 = !{null, !9}
72 !9 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !10)
73 !10 = !DICompositeType(tag: DW_TAG_class_type, name: "D", line: 1, size: 128, align: 32, file: !53, elements: !11)
74 !11 = !{!12, !14, !15, !16, !17, !20}
75 !12 = !DIDerivedType(tag: DW_TAG_member, name: "c1", line: 6, size: 32, align: 32, flags: DIFlagPrivate, file: !53, scope: !10, baseType: !13)
76 !13 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
77 !14 = !DIDerivedType(tag: DW_TAG_member, name: "c2", line: 7, size: 32, align: 32, offset: 32, flags: DIFlagPrivate, file: !53, scope: !10, baseType: !13)
78 !15 = !DIDerivedType(tag: DW_TAG_member, name: "c3", line: 8, size: 32, align: 32, offset: 64, flags: DIFlagPrivate, file: !53, scope: !10, baseType: !13)
79 !16 = !DIDerivedType(tag: DW_TAG_member, name: "c4", line: 9, size: 32, align: 32, offset: 96, flags: DIFlagPrivate, file: !53, scope: !10, baseType: !13)
80 !17 = !DISubprogram(name: "D", line: 3, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 3, file: !6, scope: !10, type: !7)
81 !20 = !DISubprogram(name: "D", line: 4, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 4, file: !6, scope: !10, type: !21)
82 !21 = !DISubroutineType(types: !22)
83 !22 = !{null, !9, !23}
84 !23 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !24)
85 !24 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !10)
86 !27 = !{!29}
87 !29 = !DILocalVariable(name: "this", line: 12, arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !5, file: !6, type: !30)
88 !30 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !10)
89 !31 = distinct !DISubprogram(name: "D", linkageName: "_ZN1DC2ERKS_", line: 19, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 19, file: !6, scope: null, type: !21, declaration: !20, variables: !32)
90 !32 = !{!34, !35}
91 !34 = !DILocalVariable(name: "this", line: 19, arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !31, file: !6, type: !30)
92 !35 = !DILocalVariable(name: "d", line: 19, arg: 2, scope: !31, file: !6, type: !23)
93 !36 = !DILocation(line: 12, scope: !5)
94 !37 = !DILocation(line: 13, scope: !38)
95 !38 = distinct !DILexicalBlock(line: 12, column: 0, file: !6, scope: !5)
96 !42 = !DILocation(line: 14, scope: !38)
97 !43 = !DILocation(line: 15, scope: !38)
98 !44 = !DILocation(line: 16, scope: !38)
99 !45 = !DILocation(line: 17, scope: !38)
100 !46 = !DILocation(line: 19, scope: !31)
101 !47 = !DILocation(line: 20, scope: !48)
102 !48 = distinct !DILexicalBlock(line: 19, column: 0, file: !6, scope: !31)
103 !49 = !DILocation(line: 21, scope: !48)
104 !50 = !DILocation(line: 22, scope: !48)
105 !51 = !DILocation(line: 23, scope: !48)
106 !52 = !DILocation(line: 24, scope: !48)
107 !53 = !DIFile(filename: "foo.cpp", directory: "/usr/local/google/home/echristo")
108 !54 = !{i32 1, !"Debug Info Version", i32 3}