Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/DebugInfo/X86/2011-12-16-BadStructRef.ll

raw
1 ; RUN: llvm-as < %s -o %t.bc
2 ; RUN: llvm-spirv %t.bc -o %t.spv
3 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o - | llvm-dis -o %t.ll
4
5 ; RUN: llc -mtriple=x86_64-apple-macosx10.7 %t.ll -o %t -filetype=obj
6 ; RUN: llvm-dwarfdump -debug-info %t | FileCheck %s
7
8 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
9 target triple = "spir64-unknown-unknown"
10
11 ; CHECK: b_ref
12 ; CHECK-NOT: AT_bit_size
13
14 %struct.bar = type { %struct.baz, %struct.baz* }
15 %struct.baz = type { i32 }
16
17 define i32 @main(i32 %argc, i8** %argv) uwtable ssp !dbg !29 {
18 entry:
19 %retval = alloca i32, align 4
20 %argc.addr = alloca i32, align 4
21 %argv.addr = alloca i8**, align 8
22 %myBar = alloca %struct.bar, align 8
23 store i32 0, i32* %retval
24 store i32 %argc, i32* %argc.addr, align 4
25 call void @llvm.dbg.declare(metadata i32* %argc.addr, metadata !49, metadata !DIExpression()), !dbg !50
26 store i8** %argv, i8*** %argv.addr, align 8
27 call void @llvm.dbg.declare(metadata i8*** %argv.addr, metadata !51, metadata !DIExpression()), !dbg !52
28 call void @llvm.dbg.declare(metadata %struct.bar* %myBar, metadata !53, metadata !DIExpression()), !dbg !55
29 call void @_ZN3barC1Ei(%struct.bar* %myBar, i32 1), !dbg !56
30 ret i32 0, !dbg !57
31 }
32
33 declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
34
35 define linkonce_odr void @_ZN3barC1Ei(%struct.bar* %this, i32 %x) unnamed_addr uwtable ssp align 2 !dbg !37 {
36 entry:
37 %this.addr = alloca %struct.bar*, align 8
38 %x.addr = alloca i32, align 4
39 store %struct.bar* %this, %struct.bar** %this.addr, align 8
40 call void @llvm.dbg.declare(metadata %struct.bar** %this.addr, metadata !58, metadata !DIExpression()), !dbg !59
41 store i32 %x, i32* %x.addr, align 4
42 call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !60, metadata !DIExpression()), !dbg !61
43 %this1 = load %struct.bar*, %struct.bar** %this.addr
44 %0 = load i32, i32* %x.addr, align 4, !dbg !62
45 call void @_ZN3barC2Ei(%struct.bar* %this1, i32 %0), !dbg !62
46 ret void, !dbg !62
47 }
48
49 define linkonce_odr void @_ZN3barC2Ei(%struct.bar* %this, i32 %x) unnamed_addr uwtable ssp align 2 !dbg !40 {
50 entry:
51 %this.addr = alloca %struct.bar*, align 8
52 %x.addr = alloca i32, align 4
53 store %struct.bar* %this, %struct.bar** %this.addr, align 8
54 call void @llvm.dbg.declare(metadata %struct.bar** %this.addr, metadata !63, metadata !DIExpression()), !dbg !64
55 store i32 %x, i32* %x.addr, align 4
56 call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !65, metadata !DIExpression()), !dbg !66
57 %this1 = load %struct.bar*, %struct.bar** %this.addr
58 %b = getelementptr inbounds %struct.bar, %struct.bar* %this1, i32 0, i32 0, !dbg !67
59 %0 = load i32, i32* %x.addr, align 4, !dbg !67
60 call void @_ZN3bazC1Ei(%struct.baz* %b, i32 %0), !dbg !67
61 %1 = getelementptr inbounds %struct.bar, %struct.bar* %this1, i32 0, i32 1, !dbg !67
62 %b2 = getelementptr inbounds %struct.bar, %struct.bar* %this1, i32 0, i32 0, !dbg !67
63 store %struct.baz* %b2, %struct.baz** %1, align 8, !dbg !67
64 ret void, !dbg !68
65 }
66
67 define linkonce_odr void @_ZN3bazC1Ei(%struct.baz* %this, i32 %a) unnamed_addr uwtable ssp align 2 !dbg !43 {
68 entry:
69 %this.addr = alloca %struct.baz*, align 8
70 %a.addr = alloca i32, align 4
71 store %struct.baz* %this, %struct.baz** %this.addr, align 8
72 call void @llvm.dbg.declare(metadata %struct.baz** %this.addr, metadata !70, metadata !DIExpression()), !dbg !71
73 store i32 %a, i32* %a.addr, align 4
74 call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !72, metadata !DIExpression()), !dbg !73
75 %this1 = load %struct.baz*, %struct.baz** %this.addr
76 %0 = load i32, i32* %a.addr, align 4, !dbg !74
77 call void @_ZN3bazC2Ei(%struct.baz* %this1, i32 %0), !dbg !74
78 ret void, !dbg !74
79 }
80
81 define linkonce_odr void @_ZN3bazC2Ei(%struct.baz* %this, i32 %a) unnamed_addr nounwind uwtable ssp align 2 !dbg !46 {
82 entry:
83 %this.addr = alloca %struct.baz*, align 8
84 %a.addr = alloca i32, align 4
85 store %struct.baz* %this, %struct.baz** %this.addr, align 8
86 call void @llvm.dbg.declare(metadata %struct.baz** %this.addr, metadata !75, metadata !DIExpression()), !dbg !76
87 store i32 %a, i32* %a.addr, align 4
88 call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !77, metadata !DIExpression()), !dbg !78
89 %this1 = load %struct.baz*, %struct.baz** %this.addr
90 %h = getelementptr inbounds %struct.baz, %struct.baz* %this1, i32 0, i32 0, !dbg !79
91 %0 = load i32, i32* %a.addr, align 4, !dbg !79
92 store i32 %0, i32* %h, align 4, !dbg !79
93 ret void, !dbg !80
94 }
95
96 !llvm.dbg.cu = !{!0}
97 !llvm.module.flags = !{!83}
98
99 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.1 (trunk 146596)", isOptimized: false, emissionKind: FullDebug, file: !82, enums: !1, retainedTypes: !3, globals: !1, imports: !1)
100 !1 = !{}
101 !3 = !{!5, !9}
102 !5 = !DICompositeType(tag: DW_TAG_class_type, name: "bar", line: 9, size: 128, align: 64, file: !82, elements: !7)
103 !6 = !DIFile(filename: "main.cpp", directory: "/Users/echristo/tmp/bad-struct-ref")
104 !7 = !{!8, !19, !21}
105 !8 = !DIDerivedType(tag: DW_TAG_member, name: "b", line: 11, size: 32, align: 32, file: !82, scope: !5, baseType: !9)
106 !9 = !DICompositeType(tag: DW_TAG_class_type, name: "baz", line: 3, size: 32, align: 32, file: !82, elements: !10)
107 !10 = !{!11, !13}
108 !11 = !DIDerivedType(tag: DW_TAG_member, name: "h", line: 5, size: 32, align: 32, file: !82, scope: !9, baseType: !12)
109 !12 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
110 !13 = !DISubprogram(name: "baz", line: 6, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, file: !82, scope: !9, type: !14)
111 !14 = !DISubroutineType(types: !15)
112 !15 = !{null, !16, !12}
113 !16 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial, baseType: !9)
114 !19 = !DIDerivedType(tag: DW_TAG_member, name: "b_ref", line: 12, size: 64, align: 64, offset: 64, file: !82, scope: !5, baseType: !20)
115 !20 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !9)
116 !21 = !DISubprogram(name: "bar", line: 13, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, file: !82, scope: !5, type: !22)
117 !22 = !DISubroutineType(types: !23)
118 !23 = !{null, !24, !12}
119 !24 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial, baseType: !5)
120 !29 = distinct !DISubprogram(name: "main", line: 17, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, file: !82, scope: !6, type: !30)
121 !30 = !DISubroutineType(types: !31)
122 !31 = !{!12, !12, !32}
123 !32 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !33)
124 !33 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !34)
125 !34 = !DIBasicType(tag: DW_TAG_base_type, name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
126 !35 = !{!36}
127 !36 = !{} ; previously: invalid DW_TAG_base_type
128 !37 = distinct !DISubprogram(name: "bar", linkageName: "_ZN3barC1Ei", line: 13, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, file: !82, scope: null, type: !22, declaration: !21)
129 !38 = !{!39}
130 !39 = !{} ; previously: invalid DW_TAG_base_type
131 !40 = distinct !DISubprogram(name: "bar", linkageName: "_ZN3barC2Ei", line: 13, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, file: !82, scope: null, type: !22, declaration: !21)
132 !41 = !{!42}
133 !42 = !{} ; previously: invalid DW_TAG_base_type
134 !43 = distinct !DISubprogram(name: "baz", linkageName: "_ZN3bazC1Ei", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, file: !82, scope: null, type: !14, declaration: !13)
135 !44 = !{!45}
136 !45 = !{} ; previously: invalid DW_TAG_base_type
137 !46 = distinct !DISubprogram(name: "baz", linkageName: "_ZN3bazC2Ei", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, file: !82, scope: null, type: !14, declaration: !13)
138 !49 = !DILocalVariable(name: "argc", line: 16, arg: 1, scope: !29, file: !6, type: !12)
139 !50 = !DILocation(line: 16, column: 14, scope: !29)
140 !51 = !DILocalVariable(name: "argv", line: 16, arg: 2, scope: !29, file: !6, type: !32)
141 !52 = !DILocation(line: 16, column: 27, scope: !29)
142 !53 = !DILocalVariable(name: "myBar", line: 18, scope: !54, file: !6, type: !5)
143 !54 = distinct !DILexicalBlock(line: 17, column: 1, file: !82, scope: !29)
144 !55 = !DILocation(line: 18, column: 9, scope: !54)
145 !56 = !DILocation(line: 18, column: 17, scope: !54)
146 !57 = !DILocation(line: 19, column: 5, scope: !54)
147 !58 = !DILocalVariable(name: "this", line: 13, arg: 1, flags: DIFlagArtificial, scope: !37, file: !6, type: !24)
148 !59 = !DILocation(line: 13, column: 5, scope: !37)
149 !60 = !DILocalVariable(name: "x", line: 13, arg: 2, scope: !37, file: !6, type: !12)
150 !61 = !DILocation(line: 13, column: 13, scope: !37)
151 !62 = !DILocation(line: 13, column: 34, scope: !37)
152 !63 = !DILocalVariable(name: "this", line: 13, arg: 1, flags: DIFlagArtificial, scope: !40, file: !6, type: !24)
153 !64 = !DILocation(line: 13, column: 5, scope: !40)
154 !65 = !DILocalVariable(name: "x", line: 13, arg: 2, scope: !40, file: !6, type: !12)
155 !66 = !DILocation(line: 13, column: 13, scope: !40)
156 !67 = !DILocation(line: 13, column: 33, scope: !40)
157 !68 = !DILocation(line: 13, column: 34, scope: !69)
158 !69 = distinct !DILexicalBlock(line: 13, column: 33, file: !82, scope: !40)
159 !70 = !DILocalVariable(name: "this", line: 6, arg: 1, flags: DIFlagArtificial, scope: !43, file: !6, type: !16)
160 !71 = !DILocation(line: 6, column: 5, scope: !43)
161 !72 = !DILocalVariable(name: "a", line: 6, arg: 2, scope: !43, file: !6, type: !12)
162 !73 = !DILocation(line: 6, column: 13, scope: !43)
163 !74 = !DILocation(line: 6, column: 24, scope: !43)
164 !75 = !DILocalVariable(name: "this", line: 6, arg: 1, flags: DIFlagArtificial, scope: !46, file: !6, type: !16)
165 !76 = !DILocation(line: 6, column: 5, scope: !46)
166 !77 = !DILocalVariable(name: "a", line: 6, arg: 2, scope: !46, file: !6, type: !12)
167 !78 = !DILocation(line: 6, column: 13, scope: !46)
168 !79 = !DILocation(line: 6, column: 23, scope: !46)
169 !80 = !DILocation(line: 6, column: 24, scope: !81)
170 !81 = distinct !DILexicalBlock(line: 6, column: 23, file: !82, scope: !46)
171 !82 = !DIFile(filename: "main.cpp", directory: "/Users/echristo/tmp/bad-struct-ref")
172 !83 = !{i32 1, !"Debug Info Version", i32 3}