1; RUN: llc --verify-machineinstrs --force-dwarf-frame-section %s -o - | FileCheck %s 2target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64" 3target triple = "thumbv7m-unknown-unknown-eabi" 4 5; Derived from 6; volatile int a, b, c, d, e, f, g, h; 7; 8; int x() { 9; int r = (a + b) / (c + d) + e + f; 10; return r + 1; 11; } 12; 13; 14; int y() { 15; int r = (a + b) / (c + d) + e + f; 16; return r + 2; 17; } 18; Checks that CFI instruction are emitted around saves/restores of 19; the LR on stack. 20 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 27 28define dso_local i32 @x() local_unnamed_addr #0 { 29entry: 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 42 ret i32 %add4 43} 44; CHECK-LABEL: x: 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 52 53define dso_local i32 @y() local_unnamed_addr #0 { 54entry: 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 67 ret i32 %add4 68} 69; CHECK-LABEL: y: 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 77 78attributes #0 = { minsize nofree norecurse nounwind optsize } 79