Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / test / DebugInfo / NVPTX / dbg-declare-alloca.ll
blob8d7608ead38edbccd396b5a96f32935a61cca831
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_30, debug
6 ; CHECK: .visible .func use_dbg_declare()
7 ; CHECK: .local .align 8 .b8 __local_depot0[8];
8 ; CHECK: mov.u64 %SPL, __local_depot0;
9 ; CHECK: add.u64 %rd1, %SP, 0;
10 ; CHECK: .loc 1 5 3                   // t.c:5:3
11 ; CHECK: { // callseq 0, 0
12 ; CHECK: .reg .b32 temp_param_reg;
13 ; CHECK: .param .b64 param0;
14 ; CHECK: st.param.b64 [param0+0], %rd1;
15 ; CHECK: call.uni
16 ; CHECK: escape_foo,
17 ; CHECK: (
18 ; CHECK: param0
19 ; CHECK: );
20 ; CHECK: } // callseq 0
21 ; CHECK: .loc 1 6 1                   // t.c:6:1
22 ; CHECK: ret;
23 ; CHECK: }
25 ; CHECK: .file 1 "test{{(/|\\\\)}}t.c"
27 ; CHECK: .section .debug_abbrev
28 ; CHECK-NEXT: {
29 ; CHECK-NEXT: .b8 1                                // Abbreviation Code
30 ; CHECK-NEXT: .b8 17                               // DW_TAG_compile_unit
31 ; CHECK-NEXT: .b8 1                                // DW_CHILDREN_yes
32 ; CHECK-NEXT: .b8 37                               // DW_AT_producer
33 ; CHECK-NEXT: .b8 8                                // DW_FORM_string
34 ; CHECK-NEXT: .b8 19                               // DW_AT_language
35 ; CHECK-NEXT: .b8 5                                // DW_FORM_data2
36 ; CHECK-NEXT: .b8 3                                // DW_AT_name
37 ; CHECK-NEXT: .b8 8                                // DW_FORM_string
38 ; CHECK-NEXT: .b8 16                               // DW_AT_stmt_list
39 ; CHECK-NEXT: .b8 6                                // DW_FORM_data4
40 ; CHECK-NEXT: .b8 27                               // DW_AT_comp_dir
41 ; CHECK-NEXT: .b8 8                                // DW_FORM_string
42 ; CHECK-NEXT: .b8 17                               // DW_AT_low_pc
43 ; CHECK-NEXT: .b8 1                                // DW_FORM_addr
44 ; CHECK-NEXT: .b8 18                               // DW_AT_high_pc
45 ; CHECK-NEXT: .b8 1                                // DW_FORM_addr
46 ; CHECK-NEXT: .b8 0                                // EOM(1)
47 ; CHECK-NEXT: .b8 0                                // EOM(2)
48 ; CHECK-NEXT: .b8 2                                // Abbreviation Code
49 ; CHECK-NEXT: .b8 46                               // DW_TAG_subprogram
50 ; CHECK-NEXT: .b8 1                                // DW_CHILDREN_yes
51 ; CHECK-NEXT: .b8 17                               // DW_AT_low_pc
52 ; CHECK-NEXT: .b8 1                                // DW_FORM_addr
53 ; CHECK-NEXT: .b8 18                               // DW_AT_high_pc
54 ; CHECK-NEXT: .b8 1                                // DW_FORM_addr
55 ; CHECK-NEXT: .b8 64                               // DW_AT_frame_base
56 ; CHECK-NEXT: .b8 10                               // DW_FORM_block1
57 ; CHECK-NEXT: .b8 3                                // DW_AT_name
58 ; CHECK-NEXT: .b8 8                                // DW_FORM_string
59 ; CHECK-NEXT: .b8 58                               // DW_AT_decl_file
60 ; CHECK-NEXT: .b8 11                               // DW_FORM_data1
61 ; CHECK-NEXT: .b8 59                               // DW_AT_decl_line
62 ; CHECK-NEXT: .b8 11                               // DW_FORM_data1
63 ; CHECK-NEXT: .b8 39                               // DW_AT_prototyped
64 ; CHECK-NEXT: .b8 12                               // DW_FORM_flag
65 ; CHECK-NEXT: .b8 63                               // DW_AT_external
66 ; CHECK-NEXT: .b8 12                               // DW_FORM_flag
67 ; CHECK-NEXT: .b8 0                                // EOM(1)
68 ; CHECK-NEXT: .b8 0                                // EOM(2)
69 ; CHECK-NEXT: .b8 3                                // Abbreviation Code
70 ; CHECK-NEXT: .b8 52                               // DW_TAG_variable
71 ; CHECK-NEXT: .b8 0                                // DW_CHILDREN_no
72 ; CHECK-NEXT: .b8 51                               // DW_AT_address_class
73 ; CHECK-NEXT: .b8 11                               // DW_FORM_data1
74 ; CHECK-NEXT: .b8 2                                // DW_AT_location
75 ; CHECK-NEXT: .b8 10                               // DW_FORM_block1
76 ; CHECK-NEXT: .b8 3                                // DW_AT_name
77 ; CHECK-NEXT: .b8 8                                // DW_FORM_string
78 ; CHECK-NEXT: .b8 58                               // DW_AT_decl_file
79 ; CHECK-NEXT: .b8 11                               // DW_FORM_data1
80 ; CHECK-NEXT: .b8 59                               // DW_AT_decl_line
81 ; CHECK-NEXT: .b8 11                               // DW_FORM_data1
82 ; CHECK-NEXT: .b8 73                               // DW_AT_type
83 ; CHECK-NEXT: .b8 19                               // DW_FORM_ref4
84 ; CHECK-NEXT: .b8 0                                // EOM(1)
85 ; CHECK-NEXT: .b8 0                                // EOM(2)
86 ; CHECK-NEXT: .b8 4                                // Abbreviation Code
87 ; CHECK-NEXT: .b8 19                               // DW_TAG_structure_type
88 ; CHECK-NEXT: .b8 1                                // DW_CHILDREN_yes
89 ; CHECK-NEXT: .b8 3                                // DW_AT_name
90 ; CHECK-NEXT: .b8 8                                // DW_FORM_string
91 ; CHECK-NEXT: .b8 11                               // DW_AT_byte_size
92 ; CHECK-NEXT: .b8 11                               // DW_FORM_data1
93 ; CHECK-NEXT: .b8 58                               // DW_AT_decl_file
94 ; CHECK-NEXT: .b8 11                               // DW_FORM_data1
95 ; CHECK-NEXT: .b8 59                               // DW_AT_decl_line
96 ; CHECK-NEXT: .b8 11                               // DW_FORM_data1
97 ; CHECK-NEXT: .b8 0                                // EOM(1)
98 ; CHECK-NEXT: .b8 0                                // EOM(2)
99 ; CHECK-NEXT: .b8 5                                // Abbreviation Code
100 ; CHECK-NEXT: .b8 13                               // DW_TAG_member
101 ; CHECK-NEXT: .b8 0                                // DW_CHILDREN_no
102 ; CHECK-NEXT: .b8 3                                // DW_AT_name
103 ; CHECK-NEXT: .b8 8                                // DW_FORM_string
104 ; CHECK-NEXT: .b8 73                               // DW_AT_type
105 ; CHECK-NEXT: .b8 19                               // DW_FORM_ref4
106 ; CHECK-NEXT: .b8 58                               // DW_AT_decl_file
107 ; CHECK-NEXT: .b8 11                               // DW_FORM_data1
108 ; CHECK-NEXT: .b8 59                               // DW_AT_decl_line
109 ; CHECK-NEXT: .b8 11                               // DW_FORM_data1
110 ; CHECK-NEXT: .b8 56                               // DW_AT_data_member_location
111 ; CHECK-NEXT: .b8 10                               // DW_FORM_block1
112 ; CHECK-NEXT: .b8 0                                // EOM(1)
113 ; CHECK-NEXT: .b8 0                                // EOM(2)
114 ; CHECK-NEXT: .b8 6                                // Abbreviation Code
115 ; CHECK-NEXT: .b8 36                               // DW_TAG_base_type
116 ; CHECK-NEXT: .b8 0                                // DW_CHILDREN_no
117 ; CHECK-NEXT: .b8 3                                // DW_AT_name
118 ; CHECK-NEXT: .b8 8                                // DW_FORM_string
119 ; CHECK-NEXT: .b8 62                               // DW_AT_encoding
120 ; CHECK-NEXT: .b8 11                               // DW_FORM_data1
121 ; CHECK-NEXT: .b8 11                               // DW_AT_byte_size
122 ; CHECK-NEXT: .b8 11                               // DW_FORM_data1
123 ; CHECK-NEXT: .b8 0                                // EOM(1)
124 ; CHECK-NEXT: .b8 0                                // EOM(2)
125 ; CHECK-NEXT: .b8 0                                // EOM(3)
126 ; CHECK-NEXT: }
127 ; CHECK-NEXT: .section .debug_info
128 ; CHECK-NEXT: {
129 ; CHECK-NEXT: .b32 134                             // Length of Unit
130 ; CHECK-NEXT: .b8 2                                // DWARF version number
131 ; CHECK-NEXT: .b8 0
132 ; CHECK-NEXT: .b32 .debug_abbrev                   // Offset Into Abbrev. Section
133 ; CHECK-NEXT: .b8 8                                // Address Size (in bytes)
134 ; CHECK-NEXT: .b8 1                                // Abbrev [1] 0xb:0x7f DW_TAG_compile_unit
135 ; CHECK-NEXT: .b8 99                               // DW_AT_producer
136 ; CHECK-NEXT: .b8 108
137 ; CHECK-NEXT: .b8 97
138 ; CHECK-NEXT: .b8 110
139 ; CHECK-NEXT: .b8 103
140 ; CHECK-NEXT: .b8 0
141 ; CHECK-NEXT: .b8 12                               // DW_AT_language
142 ; CHECK-NEXT: .b8 0
143 ; CHECK-NEXT: .b8 116                              // DW_AT_name
144 ; CHECK-NEXT: .b8 46
145 ; CHECK-NEXT: .b8 99
146 ; CHECK-NEXT: .b8 0
147 ; CHECK-NEXT: .b32 .debug_line                     // DW_AT_stmt_list
148 ; CHECK-NEXT: .b8 116                              // DW_AT_comp_dir
149 ; CHECK-NEXT: .b8 101
150 ; CHECK-NEXT: .b8 115
151 ; CHECK-NEXT: .b8 116
152 ; CHECK-NEXT: .b8 0
153 ; CHECK-NEXT: .b64 $L__func_begin0                 // DW_AT_low_pc
154 ; CHECK-NEXT: .b64 $L__func_end0                   // DW_AT_high_pc
155 ; CHECK-NEXT: .b8 2                                // Abbrev [2] 0x31:0x3c DW_TAG_subprogram
156 ; CHECK-NEXT: .b64 $L__func_begin0                 // DW_AT_low_pc
157 ; CHECK-NEXT: .b64 $L__func_end0                   // DW_AT_high_pc
158 ; CHECK-NEXT: .b8 1                                // DW_AT_frame_base
159 ; CHECK-NEXT: .b8 156
160 ; CHECK-NEXT: .b8 117                              // DW_AT_name
161 ; CHECK-NEXT: .b8 115
162 ; CHECK-NEXT: .b8 101
163 ; CHECK-NEXT: .b8 95
164 ; CHECK-NEXT: .b8 100
165 ; CHECK-NEXT: .b8 98
166 ; CHECK-NEXT: .b8 103
167 ; CHECK-NEXT: .b8 95
168 ; CHECK-NEXT: .b8 100
169 ; CHECK-NEXT: .b8 101
170 ; CHECK-NEXT: .b8 99
171 ; CHECK-NEXT: .b8 108
172 ; CHECK-NEXT: .b8 97
173 ; CHECK-NEXT: .b8 114
174 ; CHECK-NEXT: .b8 101
175 ; CHECK-NEXT: .b8 0
176 ; CHECK-NEXT: .b8 1                                // DW_AT_decl_file
177 ; CHECK-NEXT: .b8 3                                // DW_AT_decl_line
178 ; CHECK-NEXT: .b8 1                                // DW_AT_prototyped
179 ; CHECK-NEXT: .b8 1                                // DW_AT_external
180 ; CHECK-NEXT: .b8 3                                // Abbrev [3] 0x58:0x14 DW_TAG_variable
181 ; CHECK-NEXT: .b8 6                                // DW_AT_address_class
182 ; CHECK-NEXT: .b8 9                                // DW_AT_location
183 ; CHECK-NEXT: .b8 3
184 ; CHECK-NEXT: .b64 __local_depot0
185 ; CHECK-NEXT: .b8 111                              // DW_AT_name
186 ; CHECK-NEXT: .b8 0
187 ; CHECK-NEXT: .b8 1                                // DW_AT_decl_file
188 ; CHECK-NEXT: .b8 4                                // DW_AT_decl_line
189 ; CHECK-NEXT: .b32 109                             // DW_AT_type
190 ; CHECK-NEXT: .b8 0                                // End Of Children Mark
191 ; CHECK-NEXT: .b8 4                                // Abbrev [4] 0x6d:0x15 DW_TAG_structure_type
192 ; CHECK-NEXT: .b8 70                               // DW_AT_name
193 ; CHECK-NEXT: .b8 111
194 ; CHECK-NEXT: .b8 111
195 ; CHECK-NEXT: .b8 0
196 ; CHECK-NEXT: .b8 4                                // DW_AT_byte_size
197 ; CHECK-NEXT: .b8 1                                // DW_AT_decl_file
198 ; CHECK-NEXT: .b8 1                                // DW_AT_decl_line
199 ; CHECK-NEXT: .b8 5                                // Abbrev [5] 0x75:0xc DW_TAG_member
200 ; CHECK-NEXT: .b8 120                              // DW_AT_name
201 ; CHECK-NEXT: .b8 0
202 ; CHECK-NEXT: .b32 130                             // DW_AT_type
203 ; CHECK-NEXT: .b8 1                                // DW_AT_decl_file
204 ; CHECK-NEXT: .b8 1                                // DW_AT_decl_line
205 ; CHECK-NEXT: .b8 2                                // DW_AT_data_member_location
206 ; CHECK-NEXT: .b8 35
207 ; CHECK-NEXT: .b8 0
208 ; CHECK-NEXT: .b8 0                                // End Of Children Mark
209 ; CHECK-NEXT: .b8 6                                // Abbrev [6] 0x82:0x7 DW_TAG_base_type
210 ; CHECK-NEXT: .b8 105                              // DW_AT_name
211 ; CHECK-NEXT: .b8 110
212 ; CHECK-NEXT: .b8 116
213 ; CHECK-NEXT: .b8 0
214 ; CHECK-NEXT: .b8 5                                // DW_AT_encoding
215 ; CHECK-NEXT: .b8 4                                // DW_AT_byte_size
216 ; CHECK-NEXT: .b8 0                                // End Of Children Mark
217 ; CHECK-NEXT: }
219 %struct.Foo = type { i32 }
221 ; Function Attrs: noinline nounwind uwtable
222 define void @use_dbg_declare() #0 !dbg !7 {
223 entry:
224   %o = alloca %struct.Foo, align 8
225   call void @llvm.dbg.declare(metadata ptr %o, metadata !10, metadata !15), !dbg !16
226   call void @escape_foo(ptr %o), !dbg !17
227   ret void, !dbg !18
230 ; Function Attrs: nounwind readnone speculatable
231 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
233 declare void @escape_foo(ptr)
235 attributes #0 = { noinline nounwind uwtable }
236 attributes #1 = { nounwind readnone speculatable }
238 !llvm.dbg.cu = !{!0}
239 !llvm.module.flags = !{!3, !4, !5}
240 !llvm.ident = !{!6}
242 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
243 !1 = !DIFile(filename: "t.c", directory: "test")
244 !2 = !{}
245 !3 = !{i32 2, !"Dwarf Version", i32 2}
246 !4 = !{i32 2, !"Debug Info Version", i32 3}
247 !5 = !{i32 1, !"wchar_size", i32 4}
248 !6 = !{!"clang"}
249 !7 = distinct !DISubprogram(name: "use_dbg_declare", scope: !1, file: !1, line: 3, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
250 !8 = !DISubroutineType(types: !9)
251 !9 = !{null}
252 !10 = !DILocalVariable(name: "o", scope: !7, file: !1, line: 4, type: !11)
253 !11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo", file: !1, line: 1, size: 32, elements: !12)
254 !12 = !{!13}
255 !13 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !11, file: !1, line: 1, baseType: !14, size: 32)
256 !14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
257 !15 = !DIExpression()
258 !16 = !DILocation(line: 4, column: 14, scope: !7)
259 !17 = !DILocation(line: 5, column: 3, scope: !7)
260 !18 = !DILocation(line: 6, column: 1, scope: !7)