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 ; Checks that CFI instruction are emitted around saves/restores of
21 @a = dso_local global i32 0, align 4
22 @b = dso_local global i32 0, align 4
23 @c = dso_local global i32 0, align 4
24 @d = dso_local global i32 0, align 4
25 @e = dso_local global i32 0, align 4
26 @f = dso_local global i32 0, align 4
28 define dso_local i32 @x() local_unnamed_addr #0 {
30 %0 = load volatile i32, ptr @a, align 4
31 %1 = load volatile i32, ptr @b, align 4
32 %add = add nsw i32 %1, %0
33 %2 = load volatile i32, ptr @c, align 4
34 %3 = load volatile i32, ptr @d, align 4
35 %add1 = add nsw i32 %3, %2
36 %div = sdiv i32 %add, %add1
37 %4 = load volatile i32, ptr @e, align 4
38 %5 = load volatile i32, ptr @f, align 4
39 %add2 = add i32 %div, 1
40 %add3 = add i32 %add2, %4
41 %add4 = add i32 %add3, %5
45 ; CHECK: str lr, [sp, #-8]!
46 ; CHECK-NEXT: .cfi_def_cfa_offset 8
47 ; CHECK-NEXT: .cfi_offset lr, -8
48 ; CHECK-NEXT: bl OUTLINED_FUNCTION_0
49 ; CHECK-NEXT: ldr lr, [sp], #8
50 ; CHECK-NEXT: .cfi_def_cfa_offset 0
51 ; CHECK-NEXT: .cfi_restore lr
53 define dso_local i32 @y() local_unnamed_addr #0 {
55 %0 = load volatile i32, ptr @a, align 4
56 %1 = load volatile i32, ptr @b, align 4
57 %add = add nsw i32 %1, %0
58 %2 = load volatile i32, ptr @c, align 4
59 %3 = load volatile i32, ptr @d, align 4
60 %add1 = add nsw i32 %3, %2
61 %div = sdiv i32 %add, %add1
62 %4 = load volatile i32, ptr @e, align 4
63 %5 = load volatile i32, ptr @f, align 4
64 %add2 = add i32 %div, 2
65 %add3 = add i32 %add2, %4
66 %add4 = add i32 %add3, %5
70 ; CHECK: str lr, [sp, #-8]!
71 ; CHECK-NEXT: .cfi_def_cfa_offset 8
72 ; CHECK-NEXT: .cfi_offset lr, -8
73 ; CHECK-NEXT: bl OUTLINED_FUNCTION_0
74 ; CHECK-NEXT: ldr lr, [sp], #8
75 ; CHECK-NEXT: .cfi_def_cfa_offset 0
76 ; CHECK-NEXT: .cfi_restore lr
78 attributes #0 = { minsize nofree norecurse nounwind optsize }