Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / bolt / test / X86 / dwarf5-rangeoffset-to-rangeindex.s
blob481ff41c301f331da3874cd5a7c0266b100a168c
1 # REQUIRES: system-linux
3 # RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %s -o %t1.o
4 # RUN: %clang %cflags -dwarf-5 %t1.o -o %t.exe -Wl,-q
5 # RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections --always-convert-to-ranges
6 # RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe | FileCheck --check-prefix=PRECHECK %s
7 # RUN: llvm-dwarfdump --show-form --verbose --debug-addr %t.bolt > %t.txt
8 # RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt >> %t.txt
9 # RUN: cat %t.txt | FileCheck --check-prefix=POSTCHECK %s
11 # This tests conversion for DWARF5 ranges DW_AT_ranges [DW_FORM_sec_offset] to DW_AT_ranges [DW_FORM_rnglistx]
13 # PRECHECK: version = 0x0005
14 # PRECHECK: DW_AT_ranges [DW_FORM_sec_offset]
16 # POSTCHECK: Addrs: [
17 # POSTCHECK-NEXT: 0x[[#%.16x,ADDR:]]
18 # POSTCHECK-NEXT: 0x[[#%.16x,ADDR1:]]
19 # POSTCHECK: version = 0x0005
20 # POSTCHECK: DW_AT_ranges [DW_FORM_rnglistx]
21 # POSTCHECK-SAME: (indexed (0x0) rangelist = 0x00000018
22 # POSTCHECK-NEXT: [0x[[#ADDR]], 0x[[#ADDR + 11]]
23 # POSTCHECK-NEXT: [0x[[#ADDR1]], 0x[[#ADDR1 + 11]]
24 # POSTCHECK-NEXT: DW_AT_low_pc [DW_FORM_addr]
25 # POSTCHECK-NEXT: DW_AT_stmt_list [DW_FORM_sec_offset]
26 # POSTCHECK-NEXT: DW_AT_rnglists_base [DW_FORM_sec_offset] (0x0000000c)
27 # POSTCHECK-NEXT: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000008)
30 # int foo() {
31 # return 3;
32 # }
34 # int main() {
35 # return foo();
36 # }
38 .file "main.cpp"
39 .text
40 .Ltext0:
41 .file 0 "/testRangeOffsetToRangeX" "main.cpp"
42 .section .text._Z3foov,"ax",@progbits
43 .globl _Z3foov
44 .type _Z3foov, @function
45 _Z3foov:
46 .LFB0:
47 .file 1 "main.cpp"
48 .loc 0 1 11
49 .cfi_startproc
50 pushq %rbp
51 .cfi_def_cfa_offset 16
52 .cfi_offset 6, -16
53 movq %rsp, %rbp
54 .cfi_def_cfa_register 6
55 .loc 0 2 10
56 movl $3, %eax
57 .loc 0 3 1
58 popq %rbp
59 .cfi_def_cfa 7, 8
60 ret
61 .cfi_endproc
62 .LFE0:
63 .size _Z3foov, .-_Z3foov
64 .section .text.main,"ax",@progbits
65 .globl main
66 .type main, @function
67 main:
68 .LFB1:
69 .loc 0 5 12
70 .cfi_startproc
71 pushq %rbp
72 .cfi_def_cfa_offset 16
73 .cfi_offset 6, -16
74 movq %rsp, %rbp
75 .cfi_def_cfa_register 6
76 .loc 0 6 13
77 call _Z3foov
78 .loc 0 6 14
79 nop
80 .loc 0 7 1
81 popq %rbp
82 .cfi_def_cfa 7, 8
83 ret
84 .cfi_endproc
85 .LFE1:
86 .size main, .-main
87 .text
88 .Letext0:
89 .section .debug_info,"",@progbits
90 .Ldebug_info0:
91 .long 0x6e
92 .value 0x5
93 .byte 0x1
94 .byte 0x8
95 .long .Ldebug_abbrev0
96 .uleb128 0x1
97 .long .LASF2
98 .byte 0x21
99 .long .LASF0
100 .long .LASF1
101 .long .LLRL0
102 .quad 0
103 .long .Ldebug_line0
104 .uleb128 0x2
105 .long .LASF3
106 .byte 0x1
107 .byte 0x5
108 .byte 0x5
109 .long 0x48
110 .quad .LFB1
111 .quad .LFE1-.LFB1
112 .uleb128 0x1
113 .byte 0x9c
114 .uleb128 0x3
115 .byte 0x4
116 .byte 0x5
117 .string "int"
118 .uleb128 0x4
119 .string "foo"
120 .byte 0x1
121 .byte 0x1
122 .byte 0x5
123 .long .LASF4
124 .long 0x48
125 .quad .LFB0
126 .quad .LFE0-.LFB0
127 .uleb128 0x1
128 .byte 0x9c
129 .byte 0
130 .section .debug_abbrev,"",@progbits
131 .Ldebug_abbrev0:
132 .uleb128 0x1
133 .uleb128 0x11
134 .byte 0x1
135 .uleb128 0x25
136 .uleb128 0xe
137 .uleb128 0x13
138 .uleb128 0xb
139 .uleb128 0x3
140 .uleb128 0x1f
141 .uleb128 0x1b
142 .uleb128 0x1f
143 .uleb128 0x55
144 .uleb128 0x17
145 .uleb128 0x11
146 .uleb128 0x1
147 .uleb128 0x10
148 .uleb128 0x17
149 .byte 0
150 .byte 0
151 .uleb128 0x2
152 .uleb128 0x2e
153 .byte 0
154 .uleb128 0x3f
155 .uleb128 0x19
156 .uleb128 0x3
157 .uleb128 0xe
158 .uleb128 0x3a
159 .uleb128 0xb
160 .uleb128 0x3b
161 .uleb128 0xb
162 .uleb128 0x39
163 .uleb128 0xb
164 .uleb128 0x49
165 .uleb128 0x13
166 .uleb128 0x11
167 .uleb128 0x1
168 .uleb128 0x12
169 .uleb128 0x7
170 .uleb128 0x40
171 .uleb128 0x18
172 .uleb128 0x7c
173 .uleb128 0x19
174 .byte 0
175 .byte 0
176 .uleb128 0x3
177 .uleb128 0x24
178 .byte 0
179 .uleb128 0xb
180 .uleb128 0xb
181 .uleb128 0x3e
182 .uleb128 0xb
183 .uleb128 0x3
184 .uleb128 0x8
185 .byte 0
186 .byte 0
187 .uleb128 0x4
188 .uleb128 0x2e
189 .byte 0
190 .uleb128 0x3f
191 .uleb128 0x19
192 .uleb128 0x3
193 .uleb128 0x8
194 .uleb128 0x3a
195 .uleb128 0xb
196 .uleb128 0x3b
197 .uleb128 0xb
198 .uleb128 0x39
199 .uleb128 0xb
200 .uleb128 0x6e
201 .uleb128 0xe
202 .uleb128 0x49
203 .uleb128 0x13
204 .uleb128 0x11
205 .uleb128 0x1
206 .uleb128 0x12
207 .uleb128 0x7
208 .uleb128 0x40
209 .uleb128 0x18
210 .uleb128 0x7a
211 .uleb128 0x19
212 .byte 0
213 .byte 0
214 .byte 0
215 .section .debug_aranges,"",@progbits
216 .long 0x3c
217 .value 0x2
218 .long .Ldebug_info0
219 .byte 0x8
220 .byte 0
221 .value 0
222 .value 0
223 .quad .LFB0
224 .quad .LFE0-.LFB0
225 .quad .LFB1
226 .quad .LFE1-.LFB1
227 .quad 0
228 .quad 0
229 .section .debug_rnglists,"",@progbits
230 .Ldebug_ranges0:
231 .long .Ldebug_ranges3-.Ldebug_ranges2
232 .Ldebug_ranges2:
233 .value 0x5
234 .byte 0x8
235 .byte 0
236 .long 0
237 .LLRL0:
238 .byte 0x7
239 .quad .LFB0
240 .uleb128 .LFE0-.LFB0
241 .byte 0x7
242 .quad .LFB1
243 .uleb128 .LFE1-.LFB1
244 .byte 0
245 .Ldebug_ranges3:
246 .section .debug_line,"",@progbits
247 .Ldebug_line0:
248 .section .debug_str,"MS",@progbits,1
249 .LASF4:
250 .string "_Z3foov"
251 .LASF3:
252 .string "main"
253 .LASF2:
254 .string "GNU C++17 11.x"
255 .section .debug_line_str,"MS",@progbits,1
256 .LASF0:
257 .string "main.cpp"
258 .LASF1:
259 .string "/testRangeOffsetToRangeX"
260 .ident "GCC: (GNU) 11.x"
261 .section .note.GNU-stack,"",@progbits