1 ; RUN: llc --verify-machineinstrs --force-dwarf-frame-section %s -o - | FileCheck %s
2 target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
3 target triple = "thumbv7m-unknown-unknown-eabi"
6 ; volatile int a, b, c, d, e, f, g, h;
9 ; int r = a + b + c + d + e + f;
15 ; int r = a + b + c + d + e + f;
18 ; Check CFI instructions when LR is saved/restored to/from a register.
20 @a = dso_local global i32 0, align 4
21 @b = dso_local global i32 0, align 4
22 @c = dso_local global i32 0, align 4
23 @d = dso_local global i32 0, align 4
24 @e = dso_local global i32 0, align 4
25 @f = dso_local global i32 0, align 4
27 define dso_local i32 @x() local_unnamed_addr #0 {
29 %0 = load volatile i32, ptr @a, align 4
30 %1 = load volatile i32, ptr @b, align 4
31 %2 = load volatile i32, ptr @c, align 4
32 %3 = load volatile i32, ptr @d, align 4
33 %4 = load volatile i32, ptr @e, align 4
34 %5 = load volatile i32, ptr @f, align 4
36 %add1 = add i32 %add, %1
37 %add2 = add i32 %add1, %2
38 %add3 = add i32 %add2, %3
39 %add4 = add i32 %add3, %4
40 %add5 = add i32 %add4, %5
45 ; CHECK-NEXT: .cfi_register lr, r3
46 ; CHECK-NEXT: bl OUTLINED_FUNCTION_0
47 ; CHECK-NEXT: mov lr, r3
48 ; CHECK-NEXT: .cfi_restore lr
50 define dso_local i32 @y() local_unnamed_addr #0 {
52 %0 = load volatile i32, ptr @a, align 4
53 %1 = load volatile i32, ptr @b, align 4
54 %2 = load volatile i32, ptr @c, align 4
55 %3 = load volatile i32, ptr @d, align 4
56 %4 = load volatile i32, ptr @e, align 4
57 %5 = load volatile i32, ptr @f, align 4
59 %add1 = add i32 %add, %1
60 %add2 = add i32 %add1, %2
61 %add3 = add i32 %add2, %3
62 %add4 = add i32 %add3, %4
63 %add5 = add i32 %add4, %5
68 ; CHECK-NEXT: .cfi_register lr, r3
69 ; CHECK-NEXT: bl OUTLINED_FUNCTION_0
70 ; CHECK-NEXT: mov lr, r3
71 ; CHECK-NEXT: .cfi_restore lr
73 attributes #0 = { minsize nofree norecurse nounwind optsize }