1 ; RUN: llc -mtriple=nvptx64-nvidia-cuda < %s | FileCheck %s
3 @GLOBAL = addrspace(1) externally_initialized global i32 0, align 4, !dbg !0
4 @SHARED = addrspace(3) externally_initialized global i32 undef, align 4, !dbg !6
6 define void @test(float, float*, float*, i32) !dbg !17 {
7 %5 = alloca float, align 4
8 %6 = alloca float*, align 8
9 %7 = alloca float*, align 8
10 %8 = alloca i32, align 4
11 store float %0, float* %5, align 4
12 call void @llvm.dbg.declare(metadata float* %5, metadata !22, metadata !DIExpression()), !dbg !23
13 store float* %1, float** %6, align 8
14 call void @llvm.dbg.declare(metadata float** %6, metadata !24, metadata !DIExpression()), !dbg !25
15 store float* %2, float** %7, align 8
16 call void @llvm.dbg.declare(metadata float** %7, metadata !26, metadata !DIExpression()), !dbg !27
17 store i32 %3, i32* %8, align 4
18 call void @llvm.dbg.declare(metadata i32* %8, metadata !28, metadata !DIExpression()), !dbg !29
19 %9 = load float, float* %5, align 4, !dbg !30
20 %10 = load float*, float** %6, align 8, !dbg !31
21 %11 = load i32, i32* %8, align 4, !dbg !32
22 %12 = sext i32 %11 to i64, !dbg !31
23 %13 = getelementptr inbounds float, float* %10, i64 %12, !dbg !31
24 %14 = load float, float* %13, align 4, !dbg !31
25 %15 = fmul contract float %9, %14, !dbg !33
26 %16 = load float*, float** %7, align 8, !dbg !34
27 %17 = load i32, i32* %8, align 4, !dbg !35
28 %18 = sext i32 %17 to i64, !dbg !34
29 %19 = getelementptr inbounds float, float* %16, i64 %18, !dbg !34
30 store float %15, float* %19, align 4, !dbg !36
31 store i32 0, i32* addrspacecast (i32 addrspace(1)* @GLOBAL to i32*), align 4, !dbg !37
32 store i32 0, i32* addrspacecast (i32 addrspace(3)* @SHARED to i32*), align 4, !dbg !38
36 ; Function Attrs: nounwind readnone speculatable
37 declare void @llvm.dbg.declare(metadata, metadata, metadata)
40 !nvvm.annotations = !{!10}
41 !llvm.module.flags = !{!11, !12, !13, !14, !15}
44 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
45 !1 = distinct !DIGlobalVariable(name: "GLOBAL", scope: !2, file: !8, line: 3, type: !9, isLocal: false, isDefinition: true)
46 !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 9.0.0 (trunk 351969) (llvm/trunk 351973)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: None)
47 !3 = !DIFile(filename: "new.cc", directory: "/tmp")
50 !6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression(DW_OP_constu, 8, DW_OP_swap, DW_OP_xderef))
51 !7 = distinct !DIGlobalVariable(name: "SHARED", scope: !2, file: !8, line: 4, type: !9, isLocal: false, isDefinition: true)
52 !8 = !DIFile(filename: "test.cu", directory: "/tmp")
53 !9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
54 !10 = !{void (float, float*, float*, i32)* @test, !"kernel", i32 1}
55 !11 = !{i32 2, !"Dwarf Version", i32 2}
56 !12 = !{i32 2, !"Debug Info Version", i32 3}
57 !13 = !{i32 1, !"wchar_size", i32 4}
58 !14 = !{i32 4, !"nvvm-reflect-ftz", i32 0}
59 !15 = !{i32 7, !"PIC Level", i32 2}
60 !16 = !{!"clang version 9.0.0 (trunk 351969) (llvm/trunk 351973)"}
61 !17 = distinct !DISubprogram(name: "test", linkageName: "test", scope: !8, file: !8, line: 6, type: !18, scopeLine: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !40)
62 !18 = !DISubroutineType(types: !19)
63 !19 = !{null, !20, !21, !21, !9}
64 !20 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)
65 !21 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !20, size: 64)
66 !22 = !DILocalVariable(name: "a", arg: 1, scope: !17, file: !8, line: 6, type: !20)
67 !23 = !DILocation(line: 6, column: 41, scope: !17)
68 !24 = !DILocalVariable(name: "x", arg: 2, scope: !17, file: !8, line: 6, type: !21)
69 !25 = !DILocation(line: 6, column: 51, scope: !17)
70 !26 = !DILocalVariable(name: "y", arg: 3, scope: !17, file: !8, line: 6, type: !21)
71 !27 = !DILocation(line: 6, column: 61, scope: !17)
72 !28 = !DILocalVariable(name: "i", arg: 4, scope: !17, file: !8, line: 6, type: !9)
73 !29 = !DILocation(line: 6, column: 68, scope: !17)
74 !30 = !DILocation(line: 7, column: 10, scope: !17)
75 !31 = !DILocation(line: 7, column: 14, scope: !17)
76 !32 = !DILocation(line: 7, column: 16, scope: !17)
77 !33 = !DILocation(line: 7, column: 12, scope: !17)
78 !34 = !DILocation(line: 7, column: 3, scope: !17)
79 !35 = !DILocation(line: 7, column: 5, scope: !17)
80 !36 = !DILocation(line: 7, column: 8, scope: !17)
81 !37 = !DILocation(line: 8, column: 10, scope: !17)
82 !38 = !DILocation(line: 9, column: 10, scope: !17)
83 !39 = !DILocation(line: 10, column: 1, scope: !17)
84 !40 = !{!22, !24, !26, !28}
86 ; CHECK: .section .debug_abbrev
88 ; CHECK-NEXT:.b8 1 // Abbreviation Code
89 ; CHECK-NEXT:.b8 17 // DW_TAG_compile_unit
90 ; CHECK-NEXT:.b8 1 // DW_CHILDREN_yes
91 ; CHECK-NEXT:.b8 37 // DW_AT_producer
92 ; CHECK-NEXT:.b8 8 // DW_FORM_string
93 ; CHECK-NEXT:.b8 19 // DW_AT_language
94 ; CHECK-NEXT:.b8 5 // DW_FORM_data2
95 ; CHECK-NEXT:.b8 3 // DW_AT_name
96 ; CHECK-NEXT:.b8 8 // DW_FORM_string
97 ; CHECK-NEXT:.b8 16 // DW_AT_stmt_list
98 ; CHECK-NEXT:.b8 6 // DW_FORM_data4
99 ; CHECK-NEXT:.b8 27 // DW_AT_comp_dir
100 ; CHECK-NEXT:.b8 8 // DW_FORM_string
101 ; CHECK-NEXT:.b8 17 // DW_AT_low_pc
102 ; CHECK-NEXT:.b8 1 // DW_FORM_addr
103 ; CHECK-NEXT:.b8 18 // DW_AT_high_pc
104 ; CHECK-NEXT:.b8 1 // DW_FORM_addr
105 ; CHECK-NEXT:.b8 0 // EOM(1)
106 ; CHECK-NEXT:.b8 0 // EOM(2)
107 ; CHECK-NEXT:.b8 2 // Abbreviation Code
108 ; CHECK-NEXT:.b8 52 // DW_TAG_variable
109 ; CHECK-NEXT:.b8 0 // DW_CHILDREN_no
110 ; CHECK-NEXT:.b8 3 // DW_AT_name
111 ; CHECK-NEXT:.b8 8 // DW_FORM_string
112 ; CHECK-NEXT:.b8 73 // DW_AT_type
113 ; CHECK-NEXT:.b8 19 // DW_FORM_ref4
114 ; CHECK-NEXT:.b8 63 // DW_AT_external
115 ; CHECK-NEXT:.b8 12 // DW_FORM_flag
116 ; CHECK-NEXT:.b8 58 // DW_AT_decl_file
117 ; CHECK-NEXT:.b8 11 // DW_FORM_data1
118 ; CHECK-NEXT:.b8 59 // DW_AT_decl_line
119 ; CHECK-NEXT:.b8 11 // DW_FORM_data1
120 ; CHECK-NEXT:.b8 51 // DW_AT_address_class
121 ; CHECK-NEXT:.b8 11 // DW_FORM_data1
122 ; CHECK-NEXT:.b8 2 // DW_AT_location
123 ; CHECK-NEXT:.b8 10 // DW_FORM_block1
124 ; CHECK-NEXT:.b8 0 // EOM(1)
125 ; CHECK-NEXT:.b8 0 // EOM(2)
126 ; CHECK-NEXT:.b8 3 // Abbreviation Code
127 ; CHECK-NEXT:.b8 36 // DW_TAG_base_type
128 ; CHECK-NEXT:.b8 0 // DW_CHILDREN_no
129 ; CHECK-NEXT:.b8 3 // DW_AT_name
130 ; CHECK-NEXT:.b8 8 // DW_FORM_string
131 ; CHECK-NEXT:.b8 62 // DW_AT_encoding
132 ; CHECK-NEXT:.b8 11 // DW_FORM_data1
133 ; CHECK-NEXT:.b8 11 // DW_AT_byte_size
134 ; CHECK-NEXT:.b8 11 // DW_FORM_data1
135 ; CHECK-NEXT:.b8 0 // EOM(1)
136 ; CHECK-NEXT:.b8 0 // EOM(2)
137 ; CHECK-NEXT:.b8 4 // Abbreviation Code
138 ; CHECK-NEXT:.b8 46 // DW_TAG_subprogram
139 ; CHECK-NEXT:.b8 1 // DW_CHILDREN_yes
140 ; CHECK-NEXT:.b8 17 // DW_AT_low_pc
141 ; CHECK-NEXT:.b8 1 // DW_FORM_addr
142 ; CHECK-NEXT:.b8 18 // DW_AT_high_pc
143 ; CHECK-NEXT:.b8 1 // DW_FORM_addr
144 ; CHECK-NEXT:.b8 64 // DW_AT_frame_base
145 ; CHECK-NEXT:.b8 10 // DW_FORM_block1
146 ; CHECK-NEXT:.b8 135 // DW_AT_MIPS_linkage_name
148 ; CHECK-NEXT:.b8 8 // DW_FORM_string
149 ; CHECK-NEXT:.b8 3 // DW_AT_name
150 ; CHECK-NEXT:.b8 8 // DW_FORM_string
151 ; CHECK-NEXT:.b8 58 // DW_AT_decl_file
152 ; CHECK-NEXT:.b8 11 // DW_FORM_data1
153 ; CHECK-NEXT:.b8 59 // DW_AT_decl_line
154 ; CHECK-NEXT:.b8 11 // DW_FORM_data1
155 ; CHECK-NEXT:.b8 63 // DW_AT_external
156 ; CHECK-NEXT:.b8 12 // DW_FORM_flag
157 ; CHECK-NEXT:.b8 0 // EOM(1)
158 ; CHECK-NEXT:.b8 0 // EOM(2)
159 ; CHECK-NEXT:.b8 5 // Abbreviation Code
160 ; CHECK-NEXT:.b8 5 // DW_TAG_formal_parameter
161 ; CHECK-NEXT:.b8 0 // DW_CHILDREN_no
162 ; CHECK-NEXT:.b8 3 // DW_AT_name
163 ; CHECK-NEXT:.b8 8 // DW_FORM_string
164 ; CHECK-NEXT:.b8 58 // DW_AT_decl_file
165 ; CHECK-NEXT:.b8 11 // DW_FORM_data1
166 ; CHECK-NEXT:.b8 59 // DW_AT_decl_line
167 ; CHECK-NEXT:.b8 11 // DW_FORM_data1
168 ; CHECK-NEXT:.b8 73 // DW_AT_type
169 ; CHECK-NEXT:.b8 19 // DW_FORM_ref4
170 ; CHECK-NEXT:.b8 0 // EOM(1)
171 ; CHECK-NEXT:.b8 0 // EOM(2)
172 ; CHECK-NEXT:.b8 6 // Abbreviation Code
173 ; CHECK-NEXT:.b8 15 // DW_TAG_pointer_type
174 ; CHECK-NEXT:.b8 0 // DW_CHILDREN_no
175 ; CHECK-NEXT:.b8 73 // DW_AT_type
176 ; CHECK-NEXT:.b8 19 // DW_FORM_ref4
177 ; CHECK-NEXT:.b8 0 // EOM(1)
178 ; CHECK-NEXT:.b8 0 // EOM(2)
179 ; CHECK-NEXT:.b8 0 // EOM(3)
181 ; CHECK-NEXT: .section .debug_info
183 ; CHECK-NEXT:.b32 240 // Length of Unit
184 ; CHECK-NEXT:.b8 2 // DWARF version number
186 ; CHECK-NEXT:.b32 .debug_abbrev // Offset Into Abbrev. Section
187 ; CHECK-NEXT:.b8 8 // Address Size (in bytes)
188 ; CHECK-NEXT:.b8 1 // Abbrev [1] 0xb:0xe9 DW_TAG_compile_unit
189 ; CHECK-NEXT:.b8 99 // DW_AT_producer
244 ; CHECK-NEXT:.b8 4 // DW_AT_language
246 ; CHECK-NEXT:.b8 110 // DW_AT_name
253 ; CHECK-NEXT:.b32 .debug_line // DW_AT_stmt_list
254 ; CHECK-NEXT:.b8 47 // DW_AT_comp_dir
259 ; CHECK-NEXT:.b64 Lfunc_begin0 // DW_AT_low_pc
260 ; CHECK-NEXT:.b64 Lfunc_end0 // DW_AT_high_pc
261 ; CHECK-NEXT:.b8 2 // Abbrev [2] 0x65:0x1a DW_TAG_variable
262 ; CHECK-NEXT:.b8 71 // DW_AT_name
269 ; CHECK-NEXT:.b32 127 // DW_AT_type
270 ; CHECK-NEXT:.b8 1 // DW_AT_external
271 ; CHECK-NEXT:.b8 1 // DW_AT_decl_file
272 ; CHECK-NEXT:.b8 3 // DW_AT_decl_line
273 ; CHECK-NEXT:.b8 5 // DW_AT_address_class
274 ; CHECK-NEXT:.b8 9 // DW_AT_location
276 ; CHECK-NEXT:.b64 GLOBAL
277 ; CHECK-NEXT:.b8 3 // Abbrev [3] 0x7f:0x7 DW_TAG_base_type
278 ; CHECK-NEXT:.b8 105 // DW_AT_name
282 ; CHECK-NEXT:.b8 5 // DW_AT_encoding
283 ; CHECK-NEXT:.b8 4 // DW_AT_byte_size
284 ; CHECK-NEXT:.b8 2 // Abbrev [2] 0x86:0x1a DW_TAG_variable
285 ; CHECK-NEXT:.b8 83 // DW_AT_name
292 ; CHECK-NEXT:.b32 127 // DW_AT_type
293 ; CHECK-NEXT:.b8 1 // DW_AT_external
294 ; CHECK-NEXT:.b8 1 // DW_AT_decl_file
295 ; CHECK-NEXT:.b8 4 // DW_AT_decl_line
296 ; CHECK-NEXT:.b8 8 // DW_AT_address_class
297 ; CHECK-NEXT:.b8 9 // DW_AT_location
299 ; CHECK-NEXT:.b64 SHARED
300 ; CHECK-NEXT:.b8 4 // Abbrev [4] 0xa0:0x45 DW_TAG_subprogram
301 ; CHECK-NEXT:.b64 Lfunc_begin0 // DW_AT_low_pc
302 ; CHECK-NEXT:.b64 Lfunc_end0 // DW_AT_high_pc
303 ; CHECK-NEXT:.b8 1 // DW_AT_frame_base
305 ; CHECK-NEXT:.b8 116 // DW_AT_MIPS_linkage_name
310 ; CHECK-NEXT:.b8 116 // DW_AT_name
315 ; CHECK-NEXT:.b8 1 // DW_AT_decl_file
316 ; CHECK-NEXT:.b8 6 // DW_AT_decl_line
317 ; CHECK-NEXT:.b8 1 // DW_AT_external
318 ; CHECK-NEXT:.b8 5 // Abbrev [5] 0xc0:0x9 DW_TAG_formal_parameter
319 ; CHECK-NEXT:.b8 97 // DW_AT_name
321 ; CHECK-NEXT:.b8 1 // DW_AT_decl_file
322 ; CHECK-NEXT:.b8 6 // DW_AT_decl_line
323 ; CHECK-NEXT:.b32 229 // DW_AT_type
324 ; CHECK-NEXT:.b8 5 // Abbrev [5] 0xc9:0x9 DW_TAG_formal_parameter
325 ; CHECK-NEXT:.b8 120 // DW_AT_name
327 ; CHECK-NEXT:.b8 1 // DW_AT_decl_file
328 ; CHECK-NEXT:.b8 6 // DW_AT_decl_line
329 ; CHECK-NEXT:.b32 238 // DW_AT_type
330 ; CHECK-NEXT:.b8 5 // Abbrev [5] 0xd2:0x9 DW_TAG_formal_parameter
331 ; CHECK-NEXT:.b8 121 // DW_AT_name
333 ; CHECK-NEXT:.b8 1 // DW_AT_decl_file
334 ; CHECK-NEXT:.b8 6 // DW_AT_decl_line
335 ; CHECK-NEXT:.b32 238 // DW_AT_type
336 ; CHECK-NEXT:.b8 5 // Abbrev [5] 0xdb:0x9 DW_TAG_formal_parameter
337 ; CHECK-NEXT:.b8 105 // DW_AT_name
339 ; CHECK-NEXT:.b8 1 // DW_AT_decl_file
340 ; CHECK-NEXT:.b8 6 // DW_AT_decl_line
341 ; CHECK-NEXT:.b32 127 // DW_AT_type
342 ; CHECK-NEXT:.b8 0 // End Of Children Mark
343 ; CHECK-NEXT:.b8 3 // Abbrev [3] 0xe5:0x9 DW_TAG_base_type
344 ; CHECK-NEXT:.b8 102 // DW_AT_name
350 ; CHECK-NEXT:.b8 4 // DW_AT_encoding
351 ; CHECK-NEXT:.b8 4 // DW_AT_byte_size
352 ; CHECK-NEXT:.b8 6 // Abbrev [6] 0xee:0x5 DW_TAG_pointer_type
353 ; CHECK-NEXT:.b32 229 // DW_AT_type
354 ; CHECK-NEXT:.b8 0 // End Of Children Mark
356 ; CHECK-NEXT: .section .debug_loc { }