1 ; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda | FileCheck %s
2 ; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64-nvidia-cuda | %ptxas-verify %}
4 ; CHECK: .target sm_{{[0-9]+}}, debug
6 ; CHECK: .visible .func (.param .b32 func_retval0) b(
7 ; CHECK: .param .b32 b_param_0
11 ; CHECK: $L__func_begin0:
15 ; CHECK: $L__func_end0:
18 ; CHECK: .visible .func (.param .b32 func_retval0) a(
19 ; CHECK: .param .b32 a_param_0
22 ; CHECK: $L__func_begin1:
25 ; CHECK: $L__func_end1:
28 ; CHECK: .visible .func (.param .b32 func_retval0) d(
29 ; CHECK: .param .b32 d_param_0
33 ; CHECK: $L__func_begin2:
36 ; CHECK: $L__func_end2:
39 ; CHECK-NEXT: .file 1 "{{.*}}b.c"
41 ; Function Attrs: nounwind uwtable
42 define i32 @b(i32 %c) #0 !dbg !5 {
44 %c.addr = alloca i32, align 4
45 store i32 %c, ptr %c.addr, align 4
46 call void @llvm.dbg.declare(metadata ptr %c.addr, metadata !13, metadata !DIExpression()), !dbg !14
47 %0 = load i32, ptr %c.addr, align 4, !dbg !14
48 %add = add nsw i32 %0, 1, !dbg !14
49 ret i32 %add, !dbg !14
52 ; Function Attrs: nounwind uwtable
53 define i32 @a(i32 %b) #0 {
55 %b.addr = alloca i32, align 4
56 store i32 %b, ptr %b.addr, align 4
57 %0 = load i32, ptr %b.addr, align 4
58 %add = add nsw i32 %0, 1
62 ; Function Attrs: nounwind readnone
63 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
65 ; Function Attrs: nounwind uwtable
66 define i32 @d(i32 %e) #0 !dbg !10 {
68 %e.addr = alloca i32, align 4
69 store i32 %e, ptr %e.addr, align 4
70 call void @llvm.dbg.declare(metadata ptr %e.addr, metadata !15, metadata !DIExpression()), !dbg !16
71 %0 = load i32, ptr %e.addr, align 4, !dbg !16
72 %add = add nsw i32 %0, 1, !dbg !16
73 ret i32 %add, !dbg !16
76 ; CHECK: .section .debug_abbrev
78 ; CHECK-NEXT: .b8 1 // Abbreviation Code
79 ; CHECK-NEXT: .b8 17 // DW_TAG_compile_unit
80 ; CHECK-NEXT: .b8 1 // DW_CHILDREN_yes
81 ; CHECK-NEXT: .b8 37 // DW_AT_producer
82 ; CHECK-NEXT: .b8 8 // DW_FORM_string
83 ; CHECK-NEXT: .b8 19 // DW_AT_language
84 ; CHECK-NEXT: .b8 5 // DW_FORM_data2
85 ; CHECK-NEXT: .b8 3 // DW_AT_name
86 ; CHECK-NEXT: .b8 8 // DW_FORM_string
87 ; CHECK-NEXT: .b8 16 // DW_AT_stmt_list
88 ; CHECK-NEXT: .b8 6 // DW_FORM_data4
89 ; CHECK-NEXT: .b8 27 // DW_AT_comp_dir
90 ; CHECK-NEXT: .b8 8 // DW_FORM_string
91 ; CHECK-NEXT: .b8 0 // EOM(1)
92 ; CHECK-NEXT: .b8 0 // EOM(2)
93 ; CHECK-NEXT: .b8 2 // Abbreviation Code
94 ; CHECK-NEXT: .b8 46 // DW_TAG_subprogram
95 ; CHECK-NEXT: .b8 1 // DW_CHILDREN_yes
96 ; CHECK-NEXT: .b8 17 // DW_AT_low_pc
97 ; CHECK-NEXT: .b8 1 // DW_FORM_addr
98 ; CHECK-NEXT: .b8 18 // DW_AT_high_pc
99 ; CHECK-NEXT: .b8 1 // DW_FORM_addr
100 ; CHECK-NEXT: .b8 64 // DW_AT_frame_base
101 ; CHECK-NEXT: .b8 10 // DW_FORM_block1
102 ; CHECK-NEXT: .b8 3 // DW_AT_name
103 ; CHECK-NEXT: .b8 8 // DW_FORM_string
104 ; CHECK-NEXT: .b8 58 // DW_AT_decl_file
105 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
106 ; CHECK-NEXT: .b8 59 // DW_AT_decl_line
107 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
108 ; CHECK-NEXT: .b8 39 // DW_AT_prototyped
109 ; CHECK-NEXT: .b8 12 // DW_FORM_flag
110 ; CHECK-NEXT: .b8 73 // DW_AT_type
111 ; CHECK-NEXT: .b8 19 // DW_FORM_ref4
112 ; CHECK-NEXT: .b8 63 // DW_AT_external
113 ; CHECK-NEXT: .b8 12 // DW_FORM_flag
114 ; CHECK-NEXT: .b8 0 // EOM(1)
115 ; CHECK-NEXT: .b8 0 // EOM(2)
116 ; CHECK-NEXT: .b8 3 // Abbreviation Code
117 ; CHECK-NEXT: .b8 5 // DW_TAG_formal_parameter
118 ; CHECK-NEXT: .b8 0 // DW_CHILDREN_no
119 ; CHECK-NEXT: .b8 51 // DW_AT_address_class
120 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
121 ; CHECK-NEXT: .b8 2 // DW_AT_location
122 ; CHECK-NEXT: .b8 10 // DW_FORM_block1
123 ; CHECK-NEXT: .b8 3 // DW_AT_name
124 ; CHECK-NEXT: .b8 8 // DW_FORM_string
125 ; CHECK-NEXT: .b8 58 // DW_AT_decl_file
126 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
127 ; CHECK-NEXT: .b8 59 // DW_AT_decl_line
128 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
129 ; CHECK-NEXT: .b8 73 // DW_AT_type
130 ; CHECK-NEXT: .b8 19 // DW_FORM_ref4
131 ; CHECK-NEXT: .b8 0 // EOM(1)
132 ; CHECK-NEXT: .b8 0 // EOM(2)
133 ; CHECK-NEXT: .b8 4 // Abbreviation Code
134 ; CHECK-NEXT: .b8 36 // DW_TAG_base_type
135 ; CHECK-NEXT: .b8 0 // DW_CHILDREN_no
136 ; CHECK-NEXT: .b8 3 // DW_AT_name
137 ; CHECK-NEXT: .b8 8 // DW_FORM_string
138 ; CHECK-NEXT: .b8 62 // DW_AT_encoding
139 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
140 ; CHECK-NEXT: .b8 11 // DW_AT_byte_size
141 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
142 ; CHECK-NEXT: .b8 0 // EOM(1)
143 ; CHECK-NEXT: .b8 0 // EOM(2)
144 ; CHECK-NEXT: .b8 0 // EOM(3)
146 ; CHECK-NEXT: .section .debug_info
148 ; CHECK-NEXT: .b32 181 // Length of Unit
149 ; CHECK-NEXT: .b8 2 // DWARF version number
151 ; CHECK-NEXT: .b32 .debug_abbrev // Offset Into Abbrev. Section
152 ; CHECK-NEXT: .b8 8 // Address Size (in bytes)
153 ; CHECK-NEXT: .b8 1 // Abbrev [1] 0xb:0xae DW_TAG_compile_unit
154 ; CHECK-NEXT: .b8 99 // DW_AT_producer
155 ; CHECK-NEXT: .b8 108
157 ; CHECK-NEXT: .b8 110
158 ; CHECK-NEXT: .b8 103
160 ; CHECK-NEXT: .b8 118
161 ; CHECK-NEXT: .b8 101
162 ; CHECK-NEXT: .b8 114
163 ; CHECK-NEXT: .b8 115
164 ; CHECK-NEXT: .b8 105
165 ; CHECK-NEXT: .b8 111
166 ; CHECK-NEXT: .b8 110
175 ; CHECK-NEXT: .b8 116
176 ; CHECK-NEXT: .b8 114
177 ; CHECK-NEXT: .b8 117
178 ; CHECK-NEXT: .b8 110
179 ; CHECK-NEXT: .b8 107
190 ; CHECK-NEXT: .b8 108
191 ; CHECK-NEXT: .b8 108
192 ; CHECK-NEXT: .b8 118
193 ; CHECK-NEXT: .b8 109
195 ; CHECK-NEXT: .b8 116
196 ; CHECK-NEXT: .b8 114
197 ; CHECK-NEXT: .b8 117
198 ; CHECK-NEXT: .b8 110
199 ; CHECK-NEXT: .b8 107
209 ; CHECK-NEXT: .b8 12 // DW_AT_language
211 ; CHECK-NEXT: .b8 98 // DW_AT_name
215 ; CHECK-NEXT: .b32 .debug_line // DW_AT_stmt_list
216 ; CHECK-NEXT: .b8 47 // DW_AT_comp_dir
217 ; CHECK-NEXT: .b8 115
218 ; CHECK-NEXT: .b8 111
219 ; CHECK-NEXT: .b8 117
220 ; CHECK-NEXT: .b8 114
222 ; CHECK-NEXT: .b8 101
224 ; CHECK-NEXT: .b8 2 // Abbrev [2] 0x55:0x2e DW_TAG_subprogram
225 ; CHECK-NEXT: .b64 $L__func_begin0 // DW_AT_low_pc
226 ; CHECK-NEXT: .b64 $L__func_end0 // DW_AT_high_pc
227 ; CHECK-NEXT: .b8 1 // DW_AT_frame_base
228 ; CHECK-NEXT: .b8 156
229 ; CHECK-NEXT: .b8 98 // DW_AT_name
231 ; CHECK-NEXT: .b8 1 // DW_AT_decl_file
232 ; CHECK-NEXT: .b8 1 // DW_AT_decl_line
233 ; CHECK-NEXT: .b8 1 // DW_AT_prototyped
234 ; CHECK-NEXT: .b32 177 // DW_AT_type
235 ; CHECK-NEXT: .b8 1 // DW_AT_external
236 ; CHECK-NEXT: .b8 3 // Abbrev [3] 0x72:0x10 DW_TAG_formal_parameter
237 ; CHECK-NEXT: .b8 2 // DW_AT_address_class
238 ; CHECK-NEXT: .b8 5 // DW_AT_location
239 ; CHECK-NEXT: .b8 144
240 ; CHECK-NEXT: .b8 177
241 ; CHECK-NEXT: .b8 228
242 ; CHECK-NEXT: .b8 149
244 ; CHECK-NEXT: .b8 99 // DW_AT_name
246 ; CHECK-NEXT: .b8 1 // DW_AT_decl_file
247 ; CHECK-NEXT: .b8 1 // DW_AT_decl_line
248 ; CHECK-NEXT: .b32 177 // DW_AT_type
249 ; CHECK-NEXT: .b8 0 // End Of Children Mark
250 ; CHECK-NEXT: .b8 2 // Abbrev [2] 0x83:0x2e DW_TAG_subprogram
251 ; CHECK-NEXT: .b64 $L__func_begin2 // DW_AT_low_pc
252 ; CHECK-NEXT: .b64 $L__func_end2 // DW_AT_high_pc
253 ; CHECK-NEXT: .b8 1 // DW_AT_frame_base
254 ; CHECK-NEXT: .b8 156
255 ; CHECK-NEXT: .b8 100 // DW_AT_name
257 ; CHECK-NEXT: .b8 1 // DW_AT_decl_file
258 ; CHECK-NEXT: .b8 3 // DW_AT_decl_line
259 ; CHECK-NEXT: .b8 1 // DW_AT_prototyped
260 ; CHECK-NEXT: .b32 177 // DW_AT_type
261 ; CHECK-NEXT: .b8 1 // DW_AT_external
262 ; CHECK-NEXT: .b8 3 // Abbrev [3] 0xa0:0x10 DW_TAG_formal_parameter
263 ; CHECK-NEXT: .b8 2 // DW_AT_address_class
264 ; CHECK-NEXT: .b8 5 // DW_AT_location
265 ; CHECK-NEXT: .b8 144
266 ; CHECK-NEXT: .b8 177
267 ; CHECK-NEXT: .b8 228
268 ; CHECK-NEXT: .b8 149
270 ; CHECK-NEXT: .b8 101 // DW_AT_name
272 ; CHECK-NEXT: .b8 1 // DW_AT_decl_file
273 ; CHECK-NEXT: .b8 3 // DW_AT_decl_line
274 ; CHECK-NEXT: .b32 177 // DW_AT_type
275 ; CHECK-NEXT: .b8 0 // End Of Children Mark
276 ; CHECK-NEXT: .b8 4 // Abbrev [4] 0xb1:0x7 DW_TAG_base_type
277 ; CHECK-NEXT: .b8 105 // DW_AT_name
278 ; CHECK-NEXT: .b8 110
279 ; CHECK-NEXT: .b8 116
281 ; CHECK-NEXT: .b8 5 // DW_AT_encoding
282 ; CHECK-NEXT: .b8 4 // DW_AT_byte_size
283 ; CHECK-NEXT: .b8 0 // End Of Children Mark
285 ; CHECK-NEXT: .section .debug_macinfo { }
288 attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
289 attributes #1 = { nounwind readnone }
291 !llvm.ident = !{!0, !0}
293 !llvm.module.flags = !{!11, !12}
295 !0 = !{!"clang version 3.5.0 (trunk 204164) (llvm/trunk 204183)"}
296 !1 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.5.0 (trunk 204164) (llvm/trunk 204183)", isOptimized: false, emissionKind: FullDebug, file: !2, enums: !3, retainedTypes: !3, globals: !3, imports: !3, nameTableKind: None)
297 !2 = !DIFile(filename: "b.c", directory: "/source")
299 !5 = distinct !DISubprogram(name: "b", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !1, scopeLine: 1, file: !2, scope: !6, type: !7, retainedNodes: !3)
300 !6 = !DIFile(filename: "b.c", directory: "/source")
301 !7 = !DISubroutineType(types: !8)
303 !9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
304 !10 = distinct !DISubprogram(name: "d", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !1, scopeLine: 3, file: !2, scope: !6, type: !7, retainedNodes: !3)
305 !11 = !{i32 2, !"Dwarf Version", i32 2}
306 !12 = !{i32 1, !"Debug Info Version", i32 3}
307 !13 = !DILocalVariable(name: "c", line: 1, arg: 1, scope: !5, file: !6, type: !9)
308 !14 = !DILocation(line: 1, scope: !5)
309 !15 = !DILocalVariable(name: "e", line: 3, arg: 1, scope: !10, file: !6, type: !9)
310 !16 = !DILocation(line: 3, scope: !10)