1# RUN: llc -o - %s -mtriple=arm-- -run-pass prologepilog | FileCheck %s
2--- |
3  define swiftcc i8* @need_emergency_slot(i8 *swiftself %v) {
4    ; Just a dummy to add a swiftself bit. The real code is in the MI below.
5    unreachable
6  }
7...
8---
9# CHECK-LABEL: name: need_emergency_slot
10# Make sure we do not just assume an unsaved/restored callee saved register
11# is free to use. Callee saved parameters may still be used if they were used
12# to pass arguments (as in swiftself).
13name: need_emergency_slot
14tracksRegLiveness: true
15stack:
16  - { id: 0, type: default, size: 8, alignment: 8 }
17  - { id: 1, type: default, size: 4096, alignment: 8 }
18body: |
19  bb.0:
20    liveins: $r10   ; swiftself parameter comes in as $r10
21
22    ; Bring up register pressure to force emergency spilling, coax scavenging
23    ; to use $r10 as that one is not spilled/restored.
24    $r0 = IMPLICIT_DEF
25    $r1 = IMPLICIT_DEF
26    $r2 = IMPLICIT_DEF
27    $r3 = IMPLICIT_DEF
28    $r4 = IMPLICIT_DEF
29    $r5 = IMPLICIT_DEF
30    $r6 = IMPLICIT_DEF
31    $r7 = IMPLICIT_DEF
32    $r8 = IMPLICIT_DEF
33    $r9 = IMPLICIT_DEF
34    $r11 = IMPLICIT_DEF
35    $r12 = IMPLICIT_DEF
36    $lr = IMPLICIT_DEF
37
38    ; Computing the large stack offset requires an extra register. We should
39    ; not just use $r10 for that.
40    ; CHECK-NOT: STRi12 %1,{{.*}}$r10
41
42    STRi12 $r1, %stack.0, 0, 14, $noreg :: (store 4)
43
44    ; use the swiftself parameter value.
45    KILL $r10
46
47    KILL $r0
48    KILL $r1
49    KILL $r2
50    KILL $r3
51    KILL $r4
52    KILL $r5
53    KILL $r6
54    KILL $r7
55    KILL $r8
56    KILL $r9
57    KILL $r11
58    KILL $r12
59    KILL $lr
60...
61