1# RUN: llc -mtriple thumbv7m-none-eabi -run-pass prologepilog %s -o - | FileCheck %s
2
3--- |
4  define void @throw() noreturn { unreachable }
5
6  define void @ret() nounwind { ret void }
7
8  define void @tables() nounwind noreturn uwtable { ret void }
9
10  define void @noret() noreturn nounwind {
11  start:
12    %p = alloca i32
13    store i32 42, i32* %p
14    unreachable
15  }
16...
17---
18# This function may return by exception. Check that $r4 is saved and restored.
19# CHECK-LABEL: name: throw
20# CHECK: killed $r4
21# CHECK: def $r4
22name: throw
23body: |
24  bb.0:
25    $r4 = IMPLICIT_DEF
26    tBX_RET 14, $noreg
27---
28---
29# This function may return. Check that $r4 is saved and restored.
30# CHECK-LABEL: name: ret
31# CHECK: killed $r4
32# CHECK: def $r4
33name: ret
34body: |
35  bb.0:
36    $r4 = IMPLICIT_DEF
37    tBX_RET 14, $noreg
38---
39---
40# This function needs correct unwind tables anyway. Check that $r4 is saved and
41# restored.
42# CHECK-LABEL: name: tables
43# CHECK: killed $r4
44# CHECK: def $r4
45name: tables
46body: |
47  bb.0:
48    $r4 = IMPLICIT_DEF
49    tBX_RET 14, $noreg
50---
51---
52# This function does not return. We need not save any CSR, but
53# other stack adjustments in the prologue are still necessary.
54# CHECK-LABEL: name: noret
55# CHECK-NOT: killed $r4
56# CHECK-NOT: def $r4
57# CHECK: $sp = frame-setup
58name: noret
59stack:
60  - { id: 0, name: p, offset: 0, size: 4, alignment: 4, local-offset: -4 }
61body: |
62  bb.0:
63    $r4 = IMPLICIT_DEF
64    tBX_RET 14, $noreg
65---
66