1 ; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda | FileCheck %s
3 ; CHECK: .target sm_{{[0-9]+}}, debug
5 ; CHECK: .visible .func (.param .b32 func_retval0) b(
6 ; CHECK: .param .b32 b_param_0
10 ; CHECK: Lfunc_begin0:
17 ; CHECK: .visible .func (.param .b32 func_retval0) a(
18 ; CHECK: .param .b32 a_param_0
21 ; CHECK: Lfunc_begin1:
27 ; CHECK: .visible .func (.param .b32 func_retval0) d(
28 ; CHECK: .param .b32 d_param_0
32 ; CHECK: Lfunc_begin2:
38 ; CHECK: .file 1 "{{.*}}b.c"
40 ; Function Attrs: nounwind uwtable
41 define i32 @b(i32 %c) #0 !dbg !5 {
43 %c.addr = alloca i32, align 4
44 store i32 %c, i32* %c.addr, align 4
45 call void @llvm.dbg.declare(metadata i32* %c.addr, metadata !13, metadata !DIExpression()), !dbg !14
46 %0 = load i32, i32* %c.addr, align 4, !dbg !14
47 %add = add nsw i32 %0, 1, !dbg !14
48 ret i32 %add, !dbg !14
51 ; Function Attrs: nounwind uwtable
52 define i32 @a(i32 %b) #0 {
54 %b.addr = alloca i32, align 4
55 store i32 %b, i32* %b.addr, align 4
56 %0 = load i32, i32* %b.addr, align 4
57 %add = add nsw i32 %0, 1
61 ; Function Attrs: nounwind readnone
62 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
64 ; Function Attrs: nounwind uwtable
65 define i32 @d(i32 %e) #0 !dbg !10 {
67 %e.addr = alloca i32, align 4
68 store i32 %e, i32* %e.addr, align 4
69 call void @llvm.dbg.declare(metadata i32* %e.addr, metadata !15, metadata !DIExpression()), !dbg !16
70 %0 = load i32, i32* %e.addr, align 4, !dbg !16
71 %add = add nsw i32 %0, 1, !dbg !16
72 ret i32 %add, !dbg !16
75 ; CHECK: .section .debug_abbrev
77 ; CHECK-NEXT: .b8 1 // Abbreviation Code
78 ; CHECK-NEXT: .b8 17 // DW_TAG_compile_unit
79 ; CHECK-NEXT: .b8 1 // DW_CHILDREN_yes
80 ; CHECK-NEXT: .b8 37 // DW_AT_producer
81 ; CHECK-NEXT: .b8 8 // DW_FORM_string
82 ; CHECK-NEXT: .b8 19 // DW_AT_language
83 ; CHECK-NEXT: .b8 5 // DW_FORM_data2
84 ; CHECK-NEXT: .b8 3 // DW_AT_name
85 ; CHECK-NEXT: .b8 8 // DW_FORM_string
86 ; CHECK-NEXT: .b8 16 // DW_AT_stmt_list
87 ; CHECK-NEXT: .b8 6 // DW_FORM_data4
88 ; CHECK-NEXT: .b8 27 // DW_AT_comp_dir
89 ; CHECK-NEXT: .b8 8 // DW_FORM_string
90 ; CHECK-NEXT: .b8 17 // DW_AT_low_pc
91 ; CHECK-NEXT: .b8 1 // DW_FORM_addr
92 ; CHECK-NEXT: .b8 18 // DW_AT_high_pc
93 ; CHECK-NEXT: .b8 1 // DW_FORM_addr
94 ; CHECK-NEXT: .b8 0 // EOM(1)
95 ; CHECK-NEXT: .b8 0 // EOM(2)
96 ; CHECK-NEXT: .b8 2 // Abbreviation Code
97 ; CHECK-NEXT: .b8 46 // DW_TAG_subprogram
98 ; CHECK-NEXT: .b8 1 // DW_CHILDREN_yes
99 ; CHECK-NEXT: .b8 17 // DW_AT_low_pc
100 ; CHECK-NEXT: .b8 1 // DW_FORM_addr
101 ; CHECK-NEXT: .b8 18 // DW_AT_high_pc
102 ; CHECK-NEXT: .b8 1 // DW_FORM_addr
103 ; CHECK-NEXT: .b8 64 // DW_AT_frame_base
104 ; CHECK-NEXT: .b8 10 // DW_FORM_block1
105 ; CHECK-NEXT: .b8 3 // DW_AT_name
106 ; CHECK-NEXT: .b8 8 // DW_FORM_string
107 ; CHECK-NEXT: .b8 58 // DW_AT_decl_file
108 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
109 ; CHECK-NEXT: .b8 59 // DW_AT_decl_line
110 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
111 ; CHECK-NEXT: .b8 39 // DW_AT_prototyped
112 ; CHECK-NEXT: .b8 12 // DW_FORM_flag
113 ; CHECK-NEXT: .b8 73 // DW_AT_type
114 ; CHECK-NEXT: .b8 19 // DW_FORM_ref4
115 ; CHECK-NEXT: .b8 63 // DW_AT_external
116 ; CHECK-NEXT: .b8 12 // DW_FORM_flag
117 ; CHECK-NEXT: .b8 0 // EOM(1)
118 ; CHECK-NEXT: .b8 0 // EOM(2)
119 ; CHECK-NEXT: .b8 3 // Abbreviation Code
120 ; CHECK-NEXT: .b8 5 // DW_TAG_formal_parameter
121 ; CHECK-NEXT: .b8 0 // DW_CHILDREN_no
122 ; CHECK-NEXT: .b8 3 // DW_AT_name
123 ; CHECK-NEXT: .b8 8 // DW_FORM_string
124 ; CHECK-NEXT: .b8 58 // DW_AT_decl_file
125 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
126 ; CHECK-NEXT: .b8 59 // DW_AT_decl_line
127 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
128 ; CHECK-NEXT: .b8 73 // DW_AT_type
129 ; CHECK-NEXT: .b8 19 // DW_FORM_ref4
130 ; CHECK-NEXT: .b8 0 // EOM(1)
131 ; CHECK-NEXT: .b8 0 // EOM(2)
132 ; CHECK-NEXT: .b8 4 // Abbreviation Code
133 ; CHECK-NEXT: .b8 36 // DW_TAG_base_type
134 ; CHECK-NEXT: .b8 0 // DW_CHILDREN_no
135 ; CHECK-NEXT: .b8 3 // DW_AT_name
136 ; CHECK-NEXT: .b8 8 // DW_FORM_string
137 ; CHECK-NEXT: .b8 62 // DW_AT_encoding
138 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
139 ; CHECK-NEXT: .b8 11 // DW_AT_byte_size
140 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
141 ; CHECK-NEXT: .b8 0 // EOM(1)
142 ; CHECK-NEXT: .b8 0 // EOM(2)
143 ; CHECK-NEXT: .b8 0 // EOM(3)
145 ; CHECK-NEXT: .section .debug_info
147 ; CHECK-NEXT: .b32 183 // Length of Unit
148 ; CHECK-NEXT: .b8 2 // DWARF version number
150 ; CHECK-NEXT: .b32 .debug_abbrev // Offset Into Abbrev. Section
151 ; CHECK-NEXT: .b8 8 // Address Size (in bytes)
152 ; CHECK-NEXT: .b8 1 // Abbrev [1] 0xb:0xb0 DW_TAG_compile_unit
153 ; CHECK-NEXT: .b8 99 // DW_AT_producer
154 ; CHECK-NEXT: .b8 108
156 ; CHECK-NEXT: .b8 110
157 ; CHECK-NEXT: .b8 103
159 ; CHECK-NEXT: .b8 118
160 ; CHECK-NEXT: .b8 101
161 ; CHECK-NEXT: .b8 114
162 ; CHECK-NEXT: .b8 115
163 ; CHECK-NEXT: .b8 105
164 ; CHECK-NEXT: .b8 111
165 ; CHECK-NEXT: .b8 110
174 ; CHECK-NEXT: .b8 116
175 ; CHECK-NEXT: .b8 114
176 ; CHECK-NEXT: .b8 117
177 ; CHECK-NEXT: .b8 110
178 ; CHECK-NEXT: .b8 107
189 ; CHECK-NEXT: .b8 108
190 ; CHECK-NEXT: .b8 108
191 ; CHECK-NEXT: .b8 118
192 ; CHECK-NEXT: .b8 109
194 ; CHECK-NEXT: .b8 116
195 ; CHECK-NEXT: .b8 114
196 ; CHECK-NEXT: .b8 117
197 ; CHECK-NEXT: .b8 110
198 ; CHECK-NEXT: .b8 107
208 ; CHECK-NEXT: .b8 12 // DW_AT_language
210 ; CHECK-NEXT: .b8 98 // DW_AT_name
214 ; CHECK-NEXT: .b32 .debug_line // DW_AT_stmt_list
215 ; CHECK-NEXT: .b8 47 // DW_AT_comp_dir
216 ; CHECK-NEXT: .b8 115
217 ; CHECK-NEXT: .b8 111
218 ; CHECK-NEXT: .b8 117
219 ; CHECK-NEXT: .b8 114
221 ; CHECK-NEXT: .b8 101
223 ; CHECK-NEXT: .b64 Lfunc_begin0 // DW_AT_low_pc
224 ; CHECK-NEXT: .b64 Lfunc_end2 // DW_AT_high_pc
225 ; CHECK-NEXT: .b8 2 // Abbrev [2] 0x65:0x27 DW_TAG_subprogram
226 ; CHECK-NEXT: .b64 Lfunc_begin0 // DW_AT_low_pc
227 ; CHECK-NEXT: .b64 Lfunc_end0 // DW_AT_high_pc
228 ; CHECK-NEXT: .b8 1 // DW_AT_frame_base
229 ; CHECK-NEXT: .b8 156
230 ; CHECK-NEXT: .b8 98 // DW_AT_name
232 ; CHECK-NEXT: .b8 1 // DW_AT_decl_file
233 ; CHECK-NEXT: .b8 1 // DW_AT_decl_line
234 ; CHECK-NEXT: .b8 1 // DW_AT_prototyped
235 ; CHECK-NEXT: .b32 179 // DW_AT_type
236 ; CHECK-NEXT: .b8 1 // DW_AT_external
237 ; CHECK-NEXT: .b8 3 // Abbrev [3] 0x82:0x9 DW_TAG_formal_parameter
238 ; CHECK-NEXT: .b8 99 // DW_AT_name
240 ; CHECK-NEXT: .b8 1 // DW_AT_decl_file
241 ; CHECK-NEXT: .b8 1 // DW_AT_decl_line
242 ; CHECK-NEXT: .b32 179 // DW_AT_type
243 ; CHECK-NEXT: .b8 0 // End Of Children Mark
244 ; CHECK-NEXT: .b8 2 // Abbrev [2] 0x8c:0x27 DW_TAG_subprogram
245 ; CHECK-NEXT: .b64 Lfunc_begin2 // DW_AT_low_pc
246 ; CHECK-NEXT: .b64 Lfunc_end2 // DW_AT_high_pc
247 ; CHECK-NEXT: .b8 1 // DW_AT_frame_base
248 ; CHECK-NEXT: .b8 156
249 ; CHECK-NEXT: .b8 100 // DW_AT_name
251 ; CHECK-NEXT: .b8 1 // DW_AT_decl_file
252 ; CHECK-NEXT: .b8 3 // DW_AT_decl_line
253 ; CHECK-NEXT: .b8 1 // DW_AT_prototyped
254 ; CHECK-NEXT: .b32 179 // DW_AT_type
255 ; CHECK-NEXT: .b8 1 // DW_AT_external
256 ; CHECK-NEXT: .b8 3 // Abbrev [3] 0xa9:0x9 DW_TAG_formal_parameter
257 ; CHECK-NEXT: .b8 101 // DW_AT_name
259 ; CHECK-NEXT: .b8 1 // DW_AT_decl_file
260 ; CHECK-NEXT: .b8 3 // DW_AT_decl_line
261 ; CHECK-NEXT: .b32 179 // DW_AT_type
262 ; CHECK-NEXT: .b8 0 // End Of Children Mark
263 ; CHECK-NEXT: .b8 4 // Abbrev [4] 0xb3:0x7 DW_TAG_base_type
264 ; CHECK-NEXT: .b8 105 // DW_AT_name
265 ; CHECK-NEXT: .b8 110
266 ; CHECK-NEXT: .b8 116
268 ; CHECK-NEXT: .b8 5 // DW_AT_encoding
269 ; CHECK-NEXT: .b8 4 // DW_AT_byte_size
270 ; CHECK-NEXT: .b8 0 // End Of Children Mark
272 ; CHECK-NEXT: .section .debug_macinfo
274 ; CHECK-NEXT: .b8 0 // End Of Macro List Mark
277 attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
278 attributes #1 = { nounwind readnone }
280 !llvm.ident = !{!0, !0}
282 !llvm.module.flags = !{!11, !12}
284 !0 = !{!"clang version 3.5.0 (trunk 204164) (llvm/trunk 204183)"}
285 !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)
286 !2 = !DIFile(filename: "b.c", directory: "/source")
288 !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)
289 !6 = !DIFile(filename: "b.c", directory: "/source")
290 !7 = !DISubroutineType(types: !8)
292 !9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
293 !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)
294 !11 = !{i32 2, !"Dwarf Version", i32 2}
295 !12 = !{i32 1, !"Debug Info Version", i32 3}
296 !13 = !DILocalVariable(name: "c", line: 1, arg: 1, scope: !5, file: !6, type: !9)
297 !14 = !DILocation(line: 1, scope: !5)
298 !15 = !DILocalVariable(name: "e", line: 3, arg: 1, scope: !10, file: !6, type: !9)
299 !16 = !DILocation(line: 3, scope: !10)