1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64 -run-pass=cfi-fixup %s -o - | FileCheck %s
4 define i32 @f0(i32 %x) #0 {
5 entry: br label %return
6 if.end: br label %return
7 if.then2: br label %return
8 if.else: br label %return
13 define i32 @f1(i32 %x) #0 {
14 entry: br label %return
15 if.end: br label %return
16 if.then2: br label %return
17 if.else: br label %return
22 define i32 @f2(i32 %x) #0 {
23 entry: br label %return
24 if.end: br label %return
25 if.then2: br label %return
26 if.else: br label %return
33 attributes #0 = { nounwind shadowcallstack uwtable "sign-return-address"="non-leaf" "target-features"="+reserve-x18" }
39 exposesReturnsTwice: false
41 regBankSelected: false
44 tracksRegLiveness: true
46 failsVerification: false
49 - { reg: '$w0', virtual-reg: '' }
51 isFrameAddressTaken: false
52 isReturnAddressTaken: false
62 cvBytesOfCalleeSavedRegisters: 0
63 hasOpaqueSPAdjustment: false
65 hasMustTailInVarArgFunc: false
72 - { id: 0, name: '', type: spill-slot, offset: -16, size: 8, alignment: 16,
73 stack-id: default, callee-saved-register: '$lr', callee-saved-restored: true,
74 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
76 debugValueSubstitutions: []
81 ; CHECK-LABEL: name: f0
83 ; CHECK-NEXT: successors: %bb.4(0x30000000), %bb.1(0x50000000)
84 ; CHECK-NEXT: liveins: $w0, $lr, $x18
86 ; CHECK-NEXT: CBZW renamable $w0, %bb.4
88 ; CHECK-NEXT: bb.1.if.end:
89 ; CHECK-NEXT: successors: %bb.3(0x30000000), %bb.2(0x50000000)
90 ; CHECK-NEXT: liveins: $w0, $lr, $x18
92 ; CHECK-NEXT: early-clobber $x18 = frame-setup STRXpost $lr, $x18, 8
93 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION escape 0x16, 0x12, 0x02, 0x82, 0x78
94 ; CHECK-NEXT: frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
95 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION negate_ra_sign_state
96 ; CHECK-NEXT: early-clobber $sp = frame-setup STRXpre killed $lr, $sp, -16 :: (store (s64) into %stack.0)
97 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16
98 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $w30, -16
99 ; CHECK-NEXT: CFI_INSTRUCTION remember_state
100 ; CHECK-NEXT: TBNZW renamable $w0, 31, %bb.3
102 ; CHECK-NEXT: bb.2.if.else:
103 ; CHECK-NEXT: successors: %bb.5(0x80000000)
104 ; CHECK-NEXT: liveins: $w0
106 ; CHECK-NEXT: renamable $w0 = nuw nsw ADDWri killed renamable $w0, 1, 0
107 ; CHECK-NEXT: BL @g, csr_aarch64_aapcs_scs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit-def $sp, implicit-def $w0
108 ; CHECK-NEXT: renamable $w8 = MOVZWi 1, 0
109 ; CHECK-NEXT: $w0 = SUBWrs killed renamable $w8, killed renamable $w0, 0
110 ; CHECK-NEXT: B %bb.5
112 ; CHECK-NEXT: bb.3.if.then2:
113 ; CHECK-NEXT: successors: %bb.5(0x80000000)
114 ; CHECK-NEXT: liveins: $w0
116 ; CHECK-NEXT: renamable $w0 = nsw SUBWri killed renamable $w0, 1, 0
117 ; CHECK-NEXT: BL @g, csr_aarch64_aapcs_scs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit-def $sp, implicit-def $w0
118 ; CHECK-NEXT: renamable $w0 = nsw ADDWri killed renamable $w0, 1, 0
119 ; CHECK-NEXT: B %bb.5
121 ; CHECK-NEXT: bb.4.return:
122 ; CHECK-NEXT: liveins: $w0
124 ; CHECK-NEXT: CFI_INSTRUCTION def_cfa $wsp, 0
125 ; CHECK-NEXT: CFI_INSTRUCTION negate_ra_sign_state
126 ; CHECK-NEXT: CFI_INSTRUCTION same_value $w18
127 ; CHECK-NEXT: CFI_INSTRUCTION same_value $w30
128 ; CHECK-NEXT: RET undef $lr, implicit killed $w0
130 ; CHECK-NEXT: bb.5.return:
131 ; CHECK-NEXT: successors: %bb.7(0x80000000)
132 ; CHECK-NEXT: liveins: $w0
134 ; CHECK-NEXT: CFI_INSTRUCTION restore_state
135 ; CHECK-NEXT: CFI_INSTRUCTION remember_state
136 ; CHECK-NEXT: B %bb.7
138 ; CHECK-NEXT: bb.6.return:
139 ; CHECK-NEXT: liveins: $w0
141 ; CHECK-NEXT: early-clobber $sp, $lr = frame-destroy LDRXpost $sp, 16 :: (load (s64) from %stack.0)
142 ; CHECK-NEXT: frame-destroy CFI_INSTRUCTION def_cfa_offset 0
143 ; CHECK-NEXT: frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
144 ; CHECK-NEXT: frame-destroy CFI_INSTRUCTION negate_ra_sign_state
145 ; CHECK-NEXT: early-clobber $x18, $lr = frame-destroy LDRXpre $x18, -8
146 ; CHECK-NEXT: frame-destroy CFI_INSTRUCTION restore $w18
147 ; CHECK-NEXT: frame-destroy CFI_INSTRUCTION restore $w30
148 ; CHECK-NEXT: RET undef $lr, implicit killed $w0
150 ; CHECK-NEXT: bb.7.return:
151 ; CHECK-NEXT: successors: %bb.6(0x80000000)
152 ; CHECK-NEXT: liveins: $w0
154 ; CHECK-NEXT: CFI_INSTRUCTION restore_state
155 ; CHECK-NEXT: B %bb.6
157 successors: %bb.4(0x30000000), %bb.1(0x50000000)
158 liveins: $w0, $lr, $x18
160 CBZW renamable $w0, %bb.4
163 successors: %bb.3(0x30000000), %bb.2(0x50000000)
164 liveins: $w0, $lr, $x18
166 early-clobber $x18 = frame-setup STRXpost $lr, $x18, 8
167 frame-setup CFI_INSTRUCTION escape 0x16, 0x12, 0x02, 0x82, 0x78
168 frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
169 frame-setup CFI_INSTRUCTION negate_ra_sign_state
170 early-clobber $sp = frame-setup STRXpre killed $lr, $sp, -16 :: (store (s64) into %stack.0)
171 frame-setup CFI_INSTRUCTION def_cfa_offset 16
172 frame-setup CFI_INSTRUCTION offset $w30, -16
173 TBNZW renamable $w0, 31, %bb.3
176 successors: %bb.5(0x80000000)
179 renamable $w0 = nuw nsw ADDWri killed renamable $w0, 1, 0
180 BL @g, csr_aarch64_aapcs_scs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit-def $sp, implicit-def $w0
181 renamable $w8 = MOVZWi 1, 0
182 $w0 = SUBWrs killed renamable $w8, killed renamable $w0, 0
186 successors: %bb.5(0x80000000)
189 renamable $w0 = nsw SUBWri killed renamable $w0, 1, 0
190 BL @g, csr_aarch64_aapcs_scs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit-def $sp, implicit-def $w0
191 renamable $w0 = nsw ADDWri killed renamable $w0, 1, 0
196 RET undef $lr, implicit killed $w0
204 early-clobber $sp, $lr = frame-destroy LDRXpost $sp, 16 :: (load (s64) from %stack.0)
205 frame-destroy CFI_INSTRUCTION def_cfa_offset 0
206 frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
207 frame-destroy CFI_INSTRUCTION negate_ra_sign_state
208 early-clobber $x18, $lr = frame-destroy LDRXpre $x18, -8
209 frame-destroy CFI_INSTRUCTION restore $w18
210 frame-destroy CFI_INSTRUCTION restore $w30
211 RET undef $lr, implicit killed $w0
222 exposesReturnsTwice: false
224 regBankSelected: false
227 tracksRegLiveness: true
229 failsVerification: false
232 - { reg: '$w0', virtual-reg: '' }
234 isFrameAddressTaken: false
235 isReturnAddressTaken: false
245 cvBytesOfCalleeSavedRegisters: 0
246 hasOpaqueSPAdjustment: false
248 hasMustTailInVarArgFunc: false
255 - { id: 0, name: '', type: spill-slot, offset: -16, size: 8, alignment: 16,
256 stack-id: default, callee-saved-register: '$lr', callee-saved-restored: true,
257 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
259 debugValueSubstitutions: []
264 ; CHECK-LABEL: name: f1
266 ; CHECK-NEXT: successors: %bb.5(0x30000000), %bb.1(0x50000000)
267 ; CHECK-NEXT: liveins: $w0, $lr, $x18
269 ; CHECK-NEXT: CBZW renamable $w0, %bb.5
271 ; CHECK-NEXT: bb.1.if.end:
272 ; CHECK-NEXT: successors: %bb.3(0x30000000), %bb.2(0x50000000)
273 ; CHECK-NEXT: liveins: $w0, $lr, $x18
275 ; CHECK-NEXT: early-clobber $x18 = frame-setup STRXpost $lr, $x18, 8
276 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION escape 0x16, 0x12, 0x02, 0x82, 0x78
277 ; CHECK-NEXT: frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
278 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION negate_ra_sign_state
279 ; CHECK-NEXT: early-clobber $sp = frame-setup STRXpre killed $lr, $sp, -16 :: (store (s64) into %stack.0)
280 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16
281 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $w30, -16
282 ; CHECK-NEXT: TBNZW renamable $w0, 31, %bb.3
284 ; CHECK-NEXT: bb.2.if.else:
285 ; CHECK-NEXT: successors: %bb.4(0x80000000)
286 ; CHECK-NEXT: liveins: $w0
288 ; CHECK-NEXT: renamable $w0 = nuw nsw ADDWri killed renamable $w0, 1, 0
289 ; CHECK-NEXT: BL @g, csr_aarch64_aapcs_scs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit-def $sp, implicit-def $w0
290 ; CHECK-NEXT: renamable $w8 = MOVZWi 1, 0
291 ; CHECK-NEXT: $w0 = SUBWrs killed renamable $w8, killed renamable $w0, 0
292 ; CHECK-NEXT: B %bb.4
294 ; CHECK-NEXT: bb.3.if.then2:
295 ; CHECK-NEXT: successors: %bb.4(0x80000000)
296 ; CHECK-NEXT: liveins: $w0
298 ; CHECK-NEXT: renamable $w0 = nsw SUBWri killed renamable $w0, 1, 0
299 ; CHECK-NEXT: BL @g, csr_aarch64_aapcs_scs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit-def $sp, implicit-def $w0
300 ; CHECK-NEXT: renamable $w0 = nsw ADDWri killed renamable $w0, 1, 0
301 ; CHECK-NEXT: B %bb.4
303 ; CHECK-NEXT: bb.4.return:
304 ; CHECK-NEXT: liveins: $w0
306 ; CHECK-NEXT: early-clobber $sp, $lr = frame-destroy LDRXpost $sp, 16 :: (load (s64) from %stack.0)
307 ; CHECK-NEXT: frame-destroy CFI_INSTRUCTION def_cfa_offset 0
308 ; CHECK-NEXT: frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
309 ; CHECK-NEXT: frame-destroy CFI_INSTRUCTION negate_ra_sign_state
310 ; CHECK-NEXT: early-clobber $x18, $lr = frame-destroy LDRXpre $x18, -8
311 ; CHECK-NEXT: frame-destroy CFI_INSTRUCTION restore $w18
312 ; CHECK-NEXT: frame-destroy CFI_INSTRUCTION restore $w30
313 ; CHECK-NEXT: RET undef $lr, implicit killed $w0
315 ; CHECK-NEXT: bb.5.return:
316 ; CHECK-NEXT: liveins: $w0
318 ; CHECK-NEXT: RET undef $lr, implicit killed $w0
320 successors: %bb.5(0x30000000), %bb.1(0x50000000)
321 liveins: $w0, $lr, $x18
323 CBZW renamable $w0, %bb.5
326 successors: %bb.3(0x30000000), %bb.2(0x50000000)
327 liveins: $w0, $lr, $x18
329 early-clobber $x18 = frame-setup STRXpost $lr, $x18, 8
330 frame-setup CFI_INSTRUCTION escape 0x16, 0x12, 0x02, 0x82, 0x78
331 frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
332 frame-setup CFI_INSTRUCTION negate_ra_sign_state
333 early-clobber $sp = frame-setup STRXpre killed $lr, $sp, -16 :: (store (s64) into %stack.0)
334 frame-setup CFI_INSTRUCTION def_cfa_offset 16
335 frame-setup CFI_INSTRUCTION offset $w30, -16
336 TBNZW renamable $w0, 31, %bb.3
339 successors: %bb.4(0x80000000)
342 renamable $w0 = nuw nsw ADDWri killed renamable $w0, 1, 0
343 BL @g, csr_aarch64_aapcs_scs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit-def $sp, implicit-def $w0
344 renamable $w8 = MOVZWi 1, 0
345 $w0 = SUBWrs killed renamable $w8, killed renamable $w0, 0
349 successors: %bb.4(0x80000000)
352 renamable $w0 = nsw SUBWri killed renamable $w0, 1, 0
353 BL @g, csr_aarch64_aapcs_scs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit-def $sp, implicit-def $w0
354 renamable $w0 = nsw ADDWri killed renamable $w0, 1, 0
360 early-clobber $sp, $lr = frame-destroy LDRXpost $sp, 16 :: (load (s64) from %stack.0)
361 frame-destroy CFI_INSTRUCTION def_cfa_offset 0
362 frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
363 frame-destroy CFI_INSTRUCTION negate_ra_sign_state
364 early-clobber $x18, $lr = frame-destroy LDRXpre $x18, -8
365 frame-destroy CFI_INSTRUCTION restore $w18
366 frame-destroy CFI_INSTRUCTION restore $w30
367 RET undef $lr, implicit killed $w0
371 RET undef $lr, implicit killed $w0
377 exposesReturnsTwice: false
379 regBankSelected: false
382 tracksRegLiveness: true
384 failsVerification: false
387 - { reg: '$w0', virtual-reg: '' }
389 isFrameAddressTaken: false
390 isReturnAddressTaken: false
400 cvBytesOfCalleeSavedRegisters: 0
401 hasOpaqueSPAdjustment: false
403 hasMustTailInVarArgFunc: false
410 - { id: 0, name: '', type: spill-slot, offset: -16, size: 8, alignment: 16,
411 stack-id: default, callee-saved-register: '$lr', callee-saved-restored: true,
412 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
414 debugValueSubstitutions: []
419 ; CHECK-LABEL: name: f2
421 ; CHECK-NEXT: successors: %bb.5(0x30000000), %bb.1(0x50000000)
422 ; CHECK-NEXT: liveins: $w0, $lr, $x18
424 ; CHECK-NEXT: CBZW renamable $w0, %bb.5
426 ; CHECK-NEXT: bb.1.if.end:
427 ; CHECK-NEXT: successors: %bb.3(0x30000000), %bb.2(0x50000000)
428 ; CHECK-NEXT: liveins: $w0, $lr, $x18
430 ; CHECK-NEXT: early-clobber $x18 = frame-setup STRXpost $lr, $x18, 8
431 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION escape 0x16, 0x12, 0x02, 0x82, 0x78
432 ; CHECK-NEXT: frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
433 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION negate_ra_sign_state
434 ; CHECK-NEXT: early-clobber $sp = frame-setup STRXpre killed $lr, $sp, -16 :: (store (s64) into %stack.0)
435 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16
436 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $w30, -16
437 ; CHECK-NEXT: TBNZW renamable $w0, 31, %bb.3
439 ; CHECK-NEXT: bb.2.if.else:
440 ; CHECK-NEXT: successors: %bb.4(0x80000000)
441 ; CHECK-NEXT: liveins: $w0
443 ; CHECK-NEXT: renamable $w0 = nuw nsw ADDWri killed renamable $w0, 1, 0
444 ; CHECK-NEXT: BL @g, csr_aarch64_aapcs_scs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit-def $sp, implicit-def $w0
445 ; CHECK-NEXT: renamable $w8 = MOVZWi 1, 0
446 ; CHECK-NEXT: $w0 = SUBWrs killed renamable $w8, killed renamable $w0, 0
447 ; CHECK-NEXT: B %bb.4
449 ; CHECK-NEXT: bb.3.if.then2:
450 ; CHECK-NEXT: successors: %bb.4(0x80000000)
451 ; CHECK-NEXT: liveins: $w0
453 ; CHECK-NEXT: renamable $w0 = nsw SUBWri killed renamable $w0, 1, 0
454 ; CHECK-NEXT: BL @g, csr_aarch64_aapcs_scs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit-def $sp, implicit-def $w0
455 ; CHECK-NEXT: renamable $w0 = nsw ADDWri killed renamable $w0, 1, 0
456 ; CHECK-NEXT: B %bb.4
458 ; CHECK-NEXT: bb.4.return:
459 ; CHECK-NEXT: liveins: $w0
461 ; CHECK-NEXT: early-clobber $sp, $lr = frame-destroy LDRXpost $sp, 16 :: (load (s64) from %stack.0)
462 ; CHECK-NEXT: frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
463 ; CHECK-NEXT: early-clobber $x18, $lr = frame-destroy LDRXpre $x18, -8
464 ; CHECK-NEXT: RET undef $lr, implicit killed $w0
466 ; CHECK-NEXT: bb.5.return:
467 ; CHECK-NEXT: liveins: $w0
469 ; CHECK-NEXT: CFI_INSTRUCTION def_cfa $wsp, 0
470 ; CHECK-NEXT: CFI_INSTRUCTION negate_ra_sign_state
471 ; CHECK-NEXT: CFI_INSTRUCTION same_value $w18
472 ; CHECK-NEXT: CFI_INSTRUCTION same_value $w30
473 ; CHECK-NEXT: RET undef $lr, implicit killed $w0
475 successors: %bb.5(0x30000000), %bb.1(0x50000000)
476 liveins: $w0, $lr, $x18
478 CBZW renamable $w0, %bb.5
481 successors: %bb.3(0x30000000), %bb.2(0x50000000)
482 liveins: $w0, $lr, $x18
484 early-clobber $x18 = frame-setup STRXpost $lr, $x18, 8
485 frame-setup CFI_INSTRUCTION escape 0x16, 0x12, 0x02, 0x82, 0x78
486 frame-setup PACIASP implicit-def $lr, implicit killed $lr, implicit $sp
487 frame-setup CFI_INSTRUCTION negate_ra_sign_state
488 early-clobber $sp = frame-setup STRXpre killed $lr, $sp, -16 :: (store (s64) into %stack.0)
489 frame-setup CFI_INSTRUCTION def_cfa_offset 16
490 frame-setup CFI_INSTRUCTION offset $w30, -16
491 TBNZW renamable $w0, 31, %bb.3
494 successors: %bb.4(0x80000000)
497 renamable $w0 = nuw nsw ADDWri killed renamable $w0, 1, 0
498 BL @g, csr_aarch64_aapcs_scs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit-def $sp, implicit-def $w0
499 renamable $w8 = MOVZWi 1, 0
500 $w0 = SUBWrs killed renamable $w8, killed renamable $w0, 0
504 successors: %bb.4(0x80000000)
507 renamable $w0 = nsw SUBWri killed renamable $w0, 1, 0
508 BL @g, csr_aarch64_aapcs_scs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit-def $sp, implicit-def $w0
509 renamable $w0 = nsw ADDWri killed renamable $w0, 1, 0
515 early-clobber $sp, $lr = frame-destroy LDRXpost $sp, 16 :: (load (s64) from %stack.0)
516 frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp
517 early-clobber $x18, $lr = frame-destroy LDRXpre $x18, -8
518 RET undef $lr, implicit killed $w0
522 RET undef $lr, implicit killed $w0