|
| 1 | +# RUN: llc -mtriple=aarch64-none-linux-gnu -run-pass=aarch64-expand-pseudo -o - %s | FileCheck %s |
| 2 | + |
| 3 | +# When expanding a BLR_BTI, we should keep the regmask that was attached to it. |
| 4 | +# Otherwise we could end up using a register after the BL which was clobbered by |
| 5 | +# the function that was called. |
| 6 | +# CHECK: BUNDLE implicit-def $lr, implicit-def $w30, implicit-def $sp, implicit-def $wsp, implicit $sp { |
| 7 | +# CHECK: BL @_setjmp, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit-def dead $lr, implicit $sp, implicit-def $sp |
| 8 | +# CHECK: HINT 36 |
| 9 | +# CHECK: } |
| 10 | + |
| 11 | +# Generated from C, then simplified: |
| 12 | +# void _setjmp(); |
| 13 | +# void a(int b) { |
| 14 | +# _setjmp(); |
| 15 | +# for (; b;) |
| 16 | +# ; |
| 17 | +# } |
| 18 | + |
| 19 | +--- | |
| 20 | + define void @a() { |
| 21 | + ret void |
| 22 | + } |
| 23 | + |
| 24 | + declare void @_setjmp(...) |
| 25 | +... |
| 26 | +--- |
| 27 | +name: a |
| 28 | +stack: |
| 29 | + - { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16, callee-saved-register: '$x19' } |
| 30 | + - { id: 1, type: spill-slot, offset: -24, size: 8, alignment: 8, callee-saved-register: '$lr' } |
| 31 | + - { id: 2, type: spill-slot, offset: -32, size: 8, alignment: 8, callee-saved-register: '$fp' } |
| 32 | +body: | |
| 33 | + bb.0: |
| 34 | + successors: %bb.2, %bb.1 |
| 35 | + liveins: $w0, $lr, $x19 |
| 36 | +
|
| 37 | + frame-setup PAUTH_PROLOGUE implicit-def $lr, implicit $lr, implicit $sp |
| 38 | + early-clobber $sp = frame-setup STPXpre killed $fp, killed $lr, $sp, -4 :: (store (s64) into %stack.2), (store (s64) into %stack.1) |
| 39 | + frame-setup CFI_INSTRUCTION def_cfa_offset 32 |
| 40 | + frame-setup STRXui killed $x19, $sp, 2 :: (store (s64) into %stack.0) |
| 41 | + $fp = frame-setup ADDXri $sp, 0, 0 |
| 42 | + frame-setup CFI_INSTRUCTION def_cfa $w29, 32 |
| 43 | + frame-setup CFI_INSTRUCTION offset $w19, -16 |
| 44 | + frame-setup CFI_INSTRUCTION offset $w30, -24 |
| 45 | + frame-setup CFI_INSTRUCTION offset $w29, -32 |
| 46 | + $w19 = ORRWrr $wzr, $w0 |
| 47 | + BLR_BTI @_setjmp, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp |
| 48 | + CBZW killed renamable $w19, %bb.2 |
| 49 | +
|
| 50 | + bb.1: |
| 51 | + B %bb.1 |
| 52 | +
|
| 53 | + bb.2: |
| 54 | + frame-destroy CFI_INSTRUCTION def_cfa $wsp, 32 |
| 55 | + $x19 = frame-destroy LDRXui $sp, 2 :: (load (s64) from %stack.0) |
| 56 | + early-clobber $sp, $fp, $lr = frame-destroy LDPXpost $sp, 4 :: (load (s64) from %stack.2), (load (s64) from %stack.1) |
| 57 | + frame-destroy CFI_INSTRUCTION def_cfa_offset 0 |
| 58 | + frame-destroy PAUTH_EPILOGUE implicit-def $lr, implicit $lr, implicit $sp |
| 59 | + frame-destroy CFI_INSTRUCTION restore $w19 |
| 60 | + frame-destroy CFI_INSTRUCTION restore $w30 |
| 61 | + frame-destroy CFI_INSTRUCTION restore $w29 |
| 62 | + RET_ReallyLR |
| 63 | +... |
0 commit comments