Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / test / DebugInfo / XCOFF / explicit-section.ll
blob5008721795a410037c76e981e36a7870c08ba20c
2 ; RUN: llc -debugger-tune=gdb -mtriple powerpc-ibm-aix-xcoff < %s | \
3 ; RUN:   FileCheck %s
5 source_filename = "2.c"
6 target datalayout = "E-m:a-p:32:32-i64:64-n32"
8 ; Function Attrs: noinline nounwind optnone
9 define i32 @bar() #0 !dbg !8 {
10 entry:
11   ret i32 1, !dbg !13
14 ; Function Attrs: noinline nounwind optnone
15 define i32 @main() #0 section "explicit_main_sec" !dbg !14 {
16 entry:
17   %retval = alloca i32, align 4
18   store i32 0, ptr %retval, align 4
19   %call = call i32 @bar(), !dbg !15
20   ret i32 %call, !dbg !16
23 !llvm.dbg.cu = !{!0}
24 !llvm.module.flags = !{!3, !4, !5, !6}
25 !llvm.ident = !{!7}
27 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 13.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
28 !1 = !DIFile(filename: "2.c", directory: "debug")
29 !2 = !{}
30 !3 = !{i32 7, !"Dwarf Version", i32 3}
31 !4 = !{i32 2, !"Debug Info Version", i32 3}
32 !5 = !{i32 1, !"wchar_size", i32 2}
33 !6 = !{i32 7, !"PIC Level", i32 2}
34 !7 = !{!"clang version 13.0.0"}
35 !8 = distinct !DISubprogram(name: "bar", scope: !9, file: !9, line: 1, type: !10, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
36 !9 = !DIFile(filename: "2.c", directory: "debug")
37 !10 = !DISubroutineType(types: !11)
38 !11 = !{!12}
39 !12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
40 !13 = !DILocation(line: 1, column: 12, scope: !8)
41 !14 = distinct !DISubprogram(name: "main", scope: !9, file: !9, line: 2, type: !10, scopeLine: 2, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
42 !15 = !DILocation(line: 3, column: 10, scope: !14)
43 !16 = !DILocation(line: 3, column: 3, scope: !14)
45 ; CHECK:               .csect [PR],5
46 ; CHECK-NEXT:          .file   "2.c"
47 ; CHECK-NEXT:          .globl  bar[DS]                         # -- Begin function bar
48 ; CHECK-NEXT:          .globl  .bar
49 ; CHECK-NEXT:          .align  2
50 ; CHECK-NEXT:          .csect bar[DS],2
51 ; CHECK-NEXT:          .vbyte  4, .bar                         # @bar
52 ; CHECK-NEXT:          .vbyte  4, TOC[TC0]
53 ; CHECK-NEXT:          .vbyte  4, 0
54 ; CHECK-NEXT:          .csect [PR],5
55 ; CHECK-NEXT:  .bar:
56 ; CHECK-NEXT:  L..func_begin0:
57 ; CHECK-NEXT:  # %bb.0:                                # %entry
58 ; CHECK-NEXT:  L..tmp0:
59 ; CHECK-NEXT:          li 3, 1
60 ; CHECK-NEXT:          blr
61 ; CHECK-NEXT:  L..tmp1:
62 ; CHECK-NEXT:  L..bar0:
63 ; CHECK-NEXT:          .vbyte  4, 0x00000000                   # Traceback table begin
64 ; CHECK-NEXT:          .byte   0x00                            # Version = 0
65 ; CHECK-NEXT:          .byte   0x09                            # Language = CPlusPlus
66 ; CHECK-NEXT:          .byte   0x20                            # -IsGlobaLinkage, -IsOutOfLineEpilogOrPrologue
67 ; CHECK-NEXT:                                          # +HasTraceBackTableOffset, -IsInternalProcedure
68 ; CHECK-NEXT:                                          # -HasControlledStorage, -IsTOCless
69 ; CHECK-NEXT:                                          # -IsFloatingPointPresent
70 ; CHECK-NEXT:                                          # -IsFloatingPointOperationLogOrAbortEnabled
71 ; CHECK-NEXT:          .byte   0x40                            # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed
72 ; CHECK-NEXT:                                          # OnConditionDirective = 0, -IsCRSaved, -IsLRSaved
73 ; CHECK-NEXT:          .byte   0x00                            # -IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0
74 ; CHECK-NEXT:          .byte   0x00                            # -HasExtensionTable, -HasVectorInfo, NumOfGPRsSaved = 0
75 ; CHECK-NEXT:          .byte   0x00                            # NumberOfFixedParms = 0
76 ; CHECK-NEXT:          .byte   0x01                            # NumberOfFPParms = 0, +HasParmsOnStack
77 ; CHECK-NEXT:          .vbyte  4, L..bar0-.bar                 # Function size
78 ; CHECK-NEXT:          .vbyte  2, 0x0003                       # Function name len = 3
79 ; CHECK-NEXT:          .byte   "bar"                           # Function Name
80 ; CHECK-NEXT:  L..func_end0:
81 ; CHECK-NEXT:                                          # -- End function
82 ; CHECK-NEXT:          .csect explicit_main_sec[PR],5
83 ; CHECK-NEXT:          .globl  main[DS]                        # -- Begin function main
84 ; CHECK-NEXT:          .globl  .main
85 ; CHECK-NEXT:          .align  2
86 ; CHECK-NEXT:          .csect main[DS],2
87 ; CHECK-NEXT:          .vbyte  4, .main                        # @main
88 ; CHECK-NEXT:          .vbyte  4, TOC[TC0]
89 ; CHECK-NEXT:          .vbyte  4, 0
90 ; CHECK-NEXT:          .csect explicit_main_sec[PR],5
91 ; CHECK-NEXT:  .main:
92 ; CHECK-NEXT:  L..func_begin1:
93 ; CHECK-NEXT:  # %bb.0:                                # %entry
94 ; CHECK-NEXT:  L..tmp2:
95 ; CHECK-NEXT:          mflr 0
96 ; CHECK-NEXT:          stwu 1, -64(1)
97 ; CHECK-NEXT:          li 3, 0
98 ; CHECK-NEXT:          stw 0, 72(1)
99 ; CHECK-NEXT:          stw 3, 60(1)
100 ; CHECK-NEXT:  L..tmp3:
101 ; CHECK-NEXT:  L..tmp4:
102 ; CHECK-NEXT:          bl .bar
103 ; CHECK-NEXT:          nop
104 ; CHECK-NEXT:  L..tmp5:
105 ; CHECK-NEXT:          addi 1, 1, 64
106 ; CHECK-NEXT:          lwz 0, 8(1)
107 ; CHECK-NEXT:          mtlr 0
108 ; CHECK-NEXT:          blr
109 ; CHECK-NEXT:  L..tmp6:
110 ; CHECK-NEXT:  L..main0:
111 ; CHECK-NEXT:          .vbyte  4, 0x00000000                   # Traceback table begin
112 ; CHECK-NEXT:          .byte   0x00                            # Version = 0
113 ; CHECK-NEXT:          .byte   0x09                            # Language = CPlusPlus
114 ; CHECK-NEXT:          .byte   0x20                            # -IsGlobaLinkage, -IsOutOfLineEpilogOrPrologue
115 ; CHECK-NEXT:                                          # +HasTraceBackTableOffset, -IsInternalProcedure
116 ; CHECK-NEXT:                                          # -HasControlledStorage, -IsTOCless
117 ; CHECK-NEXT:                                          # -IsFloatingPointPresent
118 ; CHECK-NEXT:                                          # -IsFloatingPointOperationLogOrAbortEnabled
119 ; CHECK-NEXT:          .byte   0x41                            # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed
120 ; CHECK-NEXT:                                          # OnConditionDirective = 0, -IsCRSaved, +IsLRSaved
121 ; CHECK-NEXT:          .byte   0x80                            # +IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0
122 ; CHECK-NEXT:          .byte   0x00                            # -HasExtensionTable, -HasVectorInfo, NumOfGPRsSaved = 0
123 ; CHECK-NEXT:          .byte   0x00                            # NumberOfFixedParms = 0
124 ; CHECK-NEXT:          .byte   0x01                            # NumberOfFPParms = 0, +HasParmsOnStack
125 ; CHECK-NEXT:          .vbyte  4, L..main0-.main               # Function size
126 ; CHECK-NEXT:          .vbyte  2, 0x0004                       # Function name len = 4
127 ; CHECK-NEXT:          .byte   "main"                          # Function Name
128 ; CHECK-NEXT:  L..func_end1:
129 ; CHECK-NEXT:                                          # -- End function
130 ; CHECK-NEXT:  L..sec_end0:
131 ; CHECK:               .dwsect 0x60000
132 ; CHECK-NEXT:  L...dwabrev:
133 ; CHECK-NEXT:          .byte   1                               # Abbreviation Code
134 ; CHECK-NEXT:          .byte   17                              # DW_TAG_compile_unit
135 ; CHECK-NEXT:          .byte   1                               # DW_CHILDREN_yes
136 ; CHECK-NEXT:          .byte   37                              # DW_AT_producer
137 ; CHECK-NEXT:          .byte   14                              # DW_FORM_strp
138 ; CHECK-NEXT:          .byte   19                              # DW_AT_language
139 ; CHECK-NEXT:          .byte   5                               # DW_FORM_data2
140 ; CHECK-NEXT:          .byte   3                               # DW_AT_name
141 ; CHECK-NEXT:          .byte   14                              # DW_FORM_strp
142 ; CHECK-NEXT:          .byte   16                              # DW_AT_stmt_list
143 ; CHECK-NEXT:          .byte   6                               # DW_FORM_data4
144 ; CHECK-NEXT:          .byte   27                              # DW_AT_comp_dir
145 ; CHECK-NEXT:          .byte   14                              # DW_FORM_strp
146 ; CHECK-NEXT:          .byte   17                              # DW_AT_low_pc
147 ; CHECK-NEXT:          .byte   1                               # DW_FORM_addr
148 ; CHECK-NEXT:          .byte   85                              # DW_AT_ranges
149 ; CHECK-NEXT:          .byte   6                               # DW_FORM_data4
150 ; CHECK-NEXT:          .byte   0                               # EOM(1)
151 ; CHECK-NEXT:          .byte   0                               # EOM(2)
152 ; CHECK-NEXT:          .byte   2                               # Abbreviation Code
153 ; CHECK-NEXT:          .byte   46                              # DW_TAG_subprogram
154 ; CHECK-NEXT:          .byte   0                               # DW_CHILDREN_no
155 ; CHECK-NEXT:          .byte   17                              # DW_AT_low_pc
156 ; CHECK-NEXT:          .byte   1                               # DW_FORM_addr
157 ; CHECK-NEXT:          .byte   18                              # DW_AT_high_pc
158 ; CHECK-NEXT:          .byte   1                               # DW_FORM_addr
159 ; CHECK-NEXT:          .byte   64                              # DW_AT_frame_base
160 ; CHECK-NEXT:          .byte   10                              # DW_FORM_block1
161 ; CHECK-NEXT:          .byte   3                               # DW_AT_name
162 ; CHECK-NEXT:          .byte   14                              # DW_FORM_strp
163 ; CHECK-NEXT:          .byte   58                              # DW_AT_decl_file
164 ; CHECK-NEXT:          .byte   11                              # DW_FORM_data1
165 ; CHECK-NEXT:          .byte   59                              # DW_AT_decl_line
166 ; CHECK-NEXT:          .byte   11                              # DW_FORM_data1
167 ; CHECK-NEXT:          .byte   73                              # DW_AT_type
168 ; CHECK-NEXT:          .byte   19                              # DW_FORM_ref4
169 ; CHECK-NEXT:          .byte   63                              # DW_AT_external
170 ; CHECK-NEXT:          .byte   12                              # DW_FORM_flag
171 ; CHECK-NEXT:          .byte   0                               # EOM(1)
172 ; CHECK-NEXT:          .byte   0                               # EOM(2)
173 ; CHECK-NEXT:          .byte   3                               # Abbreviation Code
174 ; CHECK-NEXT:          .byte   36                              # DW_TAG_base_type
175 ; CHECK-NEXT:          .byte   0                               # DW_CHILDREN_no
176 ; CHECK-NEXT:          .byte   3                               # DW_AT_name
177 ; CHECK-NEXT:          .byte   14                              # DW_FORM_strp
178 ; CHECK-NEXT:          .byte   62                              # DW_AT_encoding
179 ; CHECK-NEXT:          .byte   11                              # DW_FORM_data1
180 ; CHECK-NEXT:          .byte   11                              # DW_AT_byte_size
181 ; CHECK-NEXT:          .byte   11                              # DW_FORM_data1
182 ; CHECK-NEXT:          .byte   0                               # EOM(1)
183 ; CHECK-NEXT:          .byte   0                               # EOM(2)
184 ; CHECK-NEXT:          .byte   0                               # EOM(3)
185 ; CHECK:               .dwsect 0x10000
186 ; CHECK-NEXT:  L...dwinfo:
187 ; CHECK-NEXT:  L..cu_begin0:
188 ; CHECK-NEXT:          .vbyte  2, 3                            # DWARF version number
189 ; CHECK-NEXT:          .vbyte  4, L...dwabrev                  # Offset Into Abbrev. Section
190 ; CHECK-NEXT:          .byte   4                               # Address Size (in bytes)
191 ; CHECK-NEXT:          .byte   1                               # Abbrev [1] 0xb:0x4f DW_TAG_compile_unit
192 ; CHECK-NEXT:          .vbyte  4, L..info_string0              # DW_AT_producer
193 ; CHECK-NEXT:          .vbyte  2, 12                           # DW_AT_language
194 ; CHECK-NEXT:          .vbyte  4, L..info_string1              # DW_AT_name
195 ; CHECK-NEXT:          .vbyte  4, L..line_table_start0         # DW_AT_stmt_list
196 ; CHECK-NEXT:          .vbyte  4, L..info_string2              # DW_AT_comp_dir
197 ; CHECK-NEXT:          .vbyte  4, 0                            # DW_AT_low_pc
198 ; CHECK-NEXT:          .vbyte  4, L..debug_ranges0             # DW_AT_ranges
199 ; CHECK-NEXT:          .byte   2                               # Abbrev [2] 0x26:0x16 DW_TAG_subprogram
200 ; CHECK-NEXT:          .vbyte  4, L..func_begin0               # DW_AT_low_pc
201 ; CHECK-NEXT:          .vbyte  4, L..func_end0                 # DW_AT_high_pc
202 ; CHECK-NEXT:          .byte   1                               # DW_AT_frame_base
203 ; CHECK-NEXT:          .byte   81
204 ; CHECK-NEXT:          .vbyte  4, L..info_string3              # DW_AT_name
205 ; CHECK-NEXT:          .byte   1                               # DW_AT_decl_file
206 ; CHECK-NEXT:          .byte   1                               # DW_AT_decl_line
207 ; CHECK-NEXT:          .vbyte  4, 82                           # DW_AT_type
208 ; CHECK-NEXT:          .byte   1                               # DW_AT_external
209 ; CHECK-NEXT:          .byte   2                               # Abbrev [2] 0x3c:0x16 DW_TAG_subprogram
210 ; CHECK-NEXT:          .vbyte  4, L..func_begin1               # DW_AT_low_pc
211 ; CHECK-NEXT:          .vbyte  4, L..func_end1                 # DW_AT_high_pc
212 ; CHECK-NEXT:          .byte   1                               # DW_AT_frame_base
213 ; CHECK-NEXT:          .byte   81
214 ; CHECK-NEXT:          .vbyte  4, L..info_string5              # DW_AT_name
215 ; CHECK-NEXT:          .byte   1                               # DW_AT_decl_file
216 ; CHECK-NEXT:          .byte   2                               # DW_AT_decl_line
217 ; CHECK-NEXT:          .vbyte  4, 82                           # DW_AT_type
218 ; CHECK-NEXT:          .byte   1                               # DW_AT_external
219 ; CHECK-NEXT:          .byte   3                               # Abbrev [3] 0x52:0x7 DW_TAG_base_type
220 ; CHECK-NEXT:          .vbyte  4, L..info_string4              # DW_AT_name
221 ; CHECK-NEXT:          .byte   5                               # DW_AT_encoding
222 ; CHECK-NEXT:          .byte   4                               # DW_AT_byte_size
223 ; CHECK-NEXT:          .byte   0                               # End Of Children Mark
224 ; CHECK-NEXT:  L..debug_info_end0:
225 ; CHECK:               .dwsect 0x80000
226 ; CHECK-NEXT:  L...dwrnges:
227 ; CHECK-NEXT:  L..debug_ranges0:
228 ; CHECK-NEXT:          .vbyte  4, L..func_begin0
229 ; CHECK-NEXT:          .vbyte  4, L..func_end0
230 ; CHECK-NEXT:          .vbyte  4, L..func_begin1
231 ; CHECK-NEXT:          .vbyte  4, L..func_end1
232 ; CHECK-NEXT:          .vbyte  4, 0
233 ; CHECK-NEXT:          .vbyte  4, 0
234 ; CHECK:               .dwsect 0x70000
235 ; CHECK-NEXT:  L...dwstr:
236 ; CHECK-NEXT:  L..info_string0:
237 ; CHECK-NEXT:   .string "clang version 13.0.0"          # string offset=0
238 ; CHECK-NEXT:  L..info_string1:
239 ; CHECK-NEXT:   .string "2.c"                           # string offset=21
240 ; CHECK-NEXT:  L..info_string2:
241 ; CHECK-NEXT:   .string "debug"                         # string offset=25
242 ; CHECK-NEXT:  L..info_string3:
243 ; CHECK-NEXT:   .string "bar"                           # string offset=31
244 ; CHECK-NEXT:  L..info_string4:
245 ; CHECK-NEXT:   .string "int"                           # string offset=35
246 ; CHECK-NEXT:  L..info_string5:
247 ; CHECK-NEXT:   .string "main"                          # string offset=39
248 ; CHECK-NEXT:          .toc
249 ; CHECK:               .dwsect 0x20000
250 ; CHECK-NEXT:  L...dwline:
251 ; CHECK-NEXT:  L..debug_line_0:
252 ; CHECK-NEXT:  .set L..line_table_start0, L..debug_line_0-4
253 ; CHECK-NEXT:          .vbyte  2, 3
254 ; CHECK-NEXT:          .vbyte  4, L..prologue_end0-L..prologue_start0
255 ; CHECK-NEXT:  L..prologue_start0:
256 ; CHECK-NEXT:          .byte   4
257 ; CHECK-NEXT:          .byte   1
258 ; CHECK-NEXT:          .byte   -5
259 ; CHECK-NEXT:          .byte   14
260 ; CHECK-NEXT:          .byte   13
261 ; CHECK-NEXT:          .byte   0
262 ; CHECK-NEXT:          .byte   1
263 ; CHECK-NEXT:          .byte   1
264 ; CHECK-NEXT:          .byte   1
265 ; CHECK-NEXT:          .byte   1
266 ; CHECK-NEXT:          .byte   0
267 ; CHECK-NEXT:          .byte   0
268 ; CHECK-NEXT:          .byte   0
269 ; CHECK-NEXT:          .byte   1
270 ; CHECK-NEXT:          .byte   0
271 ; CHECK-NEXT:          .byte   0
272 ; CHECK-NEXT:          .byte   1
273 ; CHECK-NEXT:          .byte   "debug"
274 ; CHECK-NEXT:          .byte   0
275 ; CHECK-NEXT:          .byte   0
276 ; CHECK-NEXT:          .byte   "2.c"
277 ; CHECK-NEXT:          .byte   0
278 ; CHECK-NEXT:          .byte   1
279 ; CHECK-NEXT:          .byte   0
280 ; CHECK-NEXT:          .byte   0
281 ; CHECK-NEXT:          .byte   0
282 ; CHECK-NEXT:  L..prologue_end0:
283 ; CHECK-NEXT:          .byte   5
284 ; CHECK-NEXT:          .byte   12
285 ; CHECK-NEXT:          .byte   10
286 ; CHECK-NEXT:          .byte   0                               # Set address to L..tmp0
287 ; CHECK-NEXT:          .byte   5
288 ; CHECK-NEXT:          .byte   2
289 ; CHECK-NEXT:          .vbyte  4, L..tmp0
290 ; CHECK-NEXT:          .byte   1                               # Start sequence
291 ; CHECK-NEXT:          .byte   0                               # Set address to L..func_end0
292 ; CHECK-NEXT:          .byte   5
293 ; CHECK-NEXT:          .byte   2
294 ; CHECK-NEXT:          .vbyte  4, L..func_end0
295 ; CHECK-NEXT:          .byte   0                               # End sequence
296 ; CHECK-NEXT:          .byte   1
297 ; CHECK-NEXT:          .byte   1
298 ; CHECK-NEXT:          .byte   0                               # Set address to L..tmp2
299 ; CHECK-NEXT:          .byte   5
300 ; CHECK-NEXT:          .byte   2
301 ; CHECK-NEXT:          .vbyte  4, L..tmp2
302 ; CHECK-NEXT:          .byte   19                              # Start sequence
303 ; CHECK-NEXT:          .byte   5
304 ; CHECK-NEXT:          .byte   10
305 ; CHECK-NEXT:          .byte   10
306 ; CHECK-NEXT:          .byte   0                               # Set address to L..tmp4
307 ; CHECK-NEXT:          .byte   5
308 ; CHECK-NEXT:          .byte   2
309 ; CHECK-NEXT:          .vbyte  4, L..tmp4
310 ; CHECK-NEXT:          .byte   3                               # Advance line 1
311 ; CHECK-NEXT:          .byte   1
312 ; CHECK-NEXT:          .byte   1
313 ; CHECK-NEXT:          .byte   5
314 ; CHECK-NEXT:          .byte   3
315 ; CHECK-NEXT:          .byte   6
316 ; CHECK-NEXT:          .byte   0                               # Set address to L..tmp5
317 ; CHECK-NEXT:          .byte   5
318 ; CHECK-NEXT:          .byte   2
319 ; CHECK-NEXT:          .vbyte  4, L..tmp5
320 ; CHECK-NEXT:          .byte   3                               # Advance line 0
321 ; CHECK-NEXT:          .byte   0
322 ; CHECK-NEXT:          .byte   1
323 ; CHECK-NEXT:          .byte   0                               # Set address to L..func_end1
324 ; CHECK-NEXT:          .byte   5
325 ; CHECK-NEXT:          .byte   2
326 ; CHECK-NEXT:          .vbyte  4, L..func_end1
327 ; CHECK-NEXT:          .byte   0                               # End sequence
328 ; CHECK-NEXT:          .byte   1
329 ; CHECK-NEXT:          .byte   1
330 ; CHECK-NEXT:  L..debug_line_end0: