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: .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 17 // DW_AT_low_pc
92 ; CHECK-NEXT: .b8 1 // DW_FORM_addr
93 ; CHECK-NEXT: .b8 18 // DW_AT_high_pc
94 ; CHECK-NEXT: .b8 1 // DW_FORM_addr
95 ; CHECK-NEXT: .b8 0 // EOM(1)
96 ; CHECK-NEXT: .b8 0 // EOM(2)
97 ; CHECK-NEXT: .b8 2 // Abbreviation Code
98 ; CHECK-NEXT: .b8 46 // DW_TAG_subprogram
99 ; CHECK-NEXT: .b8 1 // DW_CHILDREN_yes
100 ; CHECK-NEXT: .b8 17 // DW_AT_low_pc
101 ; CHECK-NEXT: .b8 1 // DW_FORM_addr
102 ; CHECK-NEXT: .b8 18 // DW_AT_high_pc
103 ; CHECK-NEXT: .b8 1 // DW_FORM_addr
104 ; CHECK-NEXT: .b8 64 // DW_AT_frame_base
105 ; CHECK-NEXT: .b8 10 // DW_FORM_block1
106 ; CHECK-NEXT: .b8 3 // DW_AT_name
107 ; CHECK-NEXT: .b8 8 // DW_FORM_string
108 ; CHECK-NEXT: .b8 58 // DW_AT_decl_file
109 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
110 ; CHECK-NEXT: .b8 59 // DW_AT_decl_line
111 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
112 ; CHECK-NEXT: .b8 39 // DW_AT_prototyped
113 ; CHECK-NEXT: .b8 12 // DW_FORM_flag
114 ; CHECK-NEXT: .b8 73 // DW_AT_type
115 ; CHECK-NEXT: .b8 19 // DW_FORM_ref4
116 ; CHECK-NEXT: .b8 63 // DW_AT_external
117 ; CHECK-NEXT: .b8 12 // DW_FORM_flag
118 ; CHECK-NEXT: .b8 0 // EOM(1)
119 ; CHECK-NEXT: .b8 0 // EOM(2)
120 ; CHECK-NEXT: .b8 3 // Abbreviation Code
121 ; CHECK-NEXT: .b8 5 // DW_TAG_formal_parameter
122 ; CHECK-NEXT: .b8 0 // DW_CHILDREN_no
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 183 // 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:0xb0 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: .b64 $L__func_begin0 // DW_AT_low_pc
225 ; CHECK-NEXT: .b64 $L__func_end2 // DW_AT_high_pc
226 ; CHECK-NEXT: .b8 2 // Abbrev [2] 0x65:0x27 DW_TAG_subprogram
227 ; CHECK-NEXT: .b64 $L__func_begin0 // DW_AT_low_pc
228 ; CHECK-NEXT: .b64 $L__func_end0 // DW_AT_high_pc
229 ; CHECK-NEXT: .b8 1 // DW_AT_frame_base
230 ; CHECK-NEXT: .b8 156
231 ; CHECK-NEXT: .b8 98 // DW_AT_name
233 ; CHECK-NEXT: .b8 1 // DW_AT_decl_file
234 ; CHECK-NEXT: .b8 1 // DW_AT_decl_line
235 ; CHECK-NEXT: .b8 1 // DW_AT_prototyped
236 ; CHECK-NEXT: .b32 179 // DW_AT_type
237 ; CHECK-NEXT: .b8 1 // DW_AT_external
238 ; CHECK-NEXT: .b8 3 // Abbrev [3] 0x82:0x9 DW_TAG_formal_parameter
239 ; CHECK-NEXT: .b8 99 // DW_AT_name
241 ; CHECK-NEXT: .b8 1 // DW_AT_decl_file
242 ; CHECK-NEXT: .b8 1 // DW_AT_decl_line
243 ; CHECK-NEXT: .b32 179 // DW_AT_type
244 ; CHECK-NEXT: .b8 0 // End Of Children Mark
245 ; CHECK-NEXT: .b8 2 // Abbrev [2] 0x8c:0x27 DW_TAG_subprogram
246 ; CHECK-NEXT: .b64 $L__func_begin2 // DW_AT_low_pc
247 ; CHECK-NEXT: .b64 $L__func_end2 // DW_AT_high_pc
248 ; CHECK-NEXT: .b8 1 // DW_AT_frame_base
249 ; CHECK-NEXT: .b8 156
250 ; CHECK-NEXT: .b8 100 // DW_AT_name
252 ; CHECK-NEXT: .b8 1 // DW_AT_decl_file
253 ; CHECK-NEXT: .b8 3 // DW_AT_decl_line
254 ; CHECK-NEXT: .b8 1 // DW_AT_prototyped
255 ; CHECK-NEXT: .b32 179 // DW_AT_type
256 ; CHECK-NEXT: .b8 1 // DW_AT_external
257 ; CHECK-NEXT: .b8 3 // Abbrev [3] 0xa9:0x9 DW_TAG_formal_parameter
258 ; CHECK-NEXT: .b8 101 // DW_AT_name
260 ; CHECK-NEXT: .b8 1 // DW_AT_decl_file
261 ; CHECK-NEXT: .b8 3 // DW_AT_decl_line
262 ; CHECK-NEXT: .b32 179 // DW_AT_type
263 ; CHECK-NEXT: .b8 0 // End Of Children Mark
264 ; CHECK-NEXT: .b8 4 // Abbrev [4] 0xb3:0x7 DW_TAG_base_type
265 ; CHECK-NEXT: .b8 105 // DW_AT_name
266 ; CHECK-NEXT: .b8 110
267 ; CHECK-NEXT: .b8 116
269 ; CHECK-NEXT: .b8 5 // DW_AT_encoding
270 ; CHECK-NEXT: .b8 4 // DW_AT_byte_size
271 ; CHECK-NEXT: .b8 0 // End Of Children Mark
273 ; CHECK-NEXT: .section .debug_loc { }
276 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" }
277 attributes #1 = { nounwind readnone }
279 !llvm.ident = !{!0, !0}
281 !llvm.module.flags = !{!11, !12}
283 !0 = !{!"clang version 3.5.0 (trunk 204164) (llvm/trunk 204183)"}
284 !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)
285 !2 = !DIFile(filename: "b.c", directory: "/source")
287 !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)
288 !6 = !DIFile(filename: "b.c", directory: "/source")
289 !7 = !DISubroutineType(types: !8)
291 !9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
292 !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)
293 !11 = !{i32 2, !"Dwarf Version", i32 2}
294 !12 = !{i32 1, !"Debug Info Version", i32 3}
295 !13 = !DILocalVariable(name: "c", line: 1, arg: 1, scope: !5, file: !6, type: !9)
296 !14 = !DILocation(line: 1, scope: !5)
297 !15 = !DILocalVariable(name: "e", line: 3, arg: 1, scope: !10, file: !6, type: !9)
298 !16 = !DILocation(line: 3, scope: !10)