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; __attribute__((noinline)) int h(int a, int b) { return a + b; } 7; 8; int f(int a, int b, int c, int d) { 9; if (a < 0) 10; return -1; 11; a = h(a, b); 12; return 2 + a * (a + b) / (c + d); 13; } 14; 15; int g(int a, int b, int c, int d) { 16; if (a < 0) 17; return -1; 18; a = h(a, b); 19; return 1 + a * (a + b) / (c + d); 20; } 21; Check CFI instructions inside the outlined function. 22 23define dso_local i32 @h(i32 %a, i32 %b) local_unnamed_addr #0 { 24entry: 25 %add = add nsw i32 %b, %a 26 ret i32 %add 27} 28 29define dso_local i32 @f(i32 %a, i32 %b, i32 %c, i32 %d) local_unnamed_addr #1 { 30entry: 31 %cmp = icmp slt i32 %a, 0 32 br i1 %cmp, label %return, label %if.end 33 34if.end: ; preds = %entry 35 %call = tail call i32 @h(i32 %a, i32 %b) #2 36 %add = add nsw i32 %call, %b 37 %mul = mul nsw i32 %add, %call 38 %add1 = add nsw i32 %d, %c 39 %div = sdiv i32 %mul, %add1 40 %add2 = add nsw i32 %div, 2 41 br label %return 42 43return: ; preds = %entry, %if.end 44 %retval.0 = phi i32 [ %add2, %if.end ], [ -1, %entry ] 45 ret i32 %retval.0 46} 47 48define dso_local i32 @g(i32 %a, i32 %b, i32 %c, i32 %d) local_unnamed_addr #1 { 49entry: 50 %cmp = icmp slt i32 %a, 0 51 br i1 %cmp, label %return, label %if.end 52 53if.end: ; preds = %entry 54 %call = tail call i32 @h(i32 %a, i32 %b) #2 55 %add = add nsw i32 %call, %b 56 %mul = mul nsw i32 %add, %call 57 %add1 = add nsw i32 %d, %c 58 %div = sdiv i32 %mul, %add1 59 %add2 = add nsw i32 %div, 1 60 br label %return 61 62return: ; preds = %entry, %if.end 63 %retval.0 = phi i32 [ %add2, %if.end ], [ -1, %entry ] 64 ret i32 %retval.0 65} 66 67; CHECK-LABEL: OUTLINED_FUNCTION_0: 68; CHECK: str lr, [sp, #-8]! 69; CHECK-NEXT: .cfi_def_cfa_offset 8 70; CHECK-NEXT: .cfi_offset lr, -8 71; CHECK: ldr lr, [sp], #8 72; CHECK-NEXT: .cfi_def_cfa_offset 0 73; CHECK-NEXT: .cfi_restore lr 74; CHECK-NEXT: bx lr 75 76attributes #0 = { minsize noinline norecurse nounwind optsize readnone } 77attributes #1 = { minsize norecurse nounwind optsize readnone } 78attributes #2 = { minsize optsize } 79