File: machine-outliner-cfi-2.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (73 lines) | stat: -rw-r--r-- 2,086 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
; RUN: llc --verify-machineinstrs --force-dwarf-frame-section %s -o - | FileCheck %s
target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
target triple = "thumbv7m-unknown-unknown-eabi"

; Derived from
; volatile int a, b, c, d, e, f, g, h;
;
; int x() {
;   int r = a + b + c + d + e + f;
;   return r + 1;
; }
;
;
; int y() {
;   int r = a + b + c + d + e + f;
;   return r + 2;
; }
; Check CFI instructions when LR is saved/restored to/from a register.

@a = dso_local global i32 0, align 4
@b = dso_local global i32 0, align 4
@c = dso_local global i32 0, align 4
@d = dso_local global i32 0, align 4
@e = dso_local global i32 0, align 4
@f = dso_local global i32 0, align 4

define dso_local i32 @x() local_unnamed_addr #0 {
entry:
  %0 = load volatile i32, ptr @a, align 4
  %1 = load volatile i32, ptr @b, align 4
  %2 = load volatile i32, ptr @c, align 4
  %3 = load volatile i32, ptr @d, align 4
  %4 = load volatile i32, ptr @e, align 4
  %5 = load volatile i32, ptr @f, align 4
  %add = add i32 %0, 1
  %add1 = add i32 %add, %1
  %add2 = add i32 %add1, %2
  %add3 = add i32 %add2, %3
  %add4 = add i32 %add3, %4
  %add5 = add i32 %add4, %5
  ret i32 %add5
}
; CHECK-LABEL: x:
; CHECK:      mov r3, lr
; CHECK-NEXT: .cfi_register lr, r3
; CHECK-NEXT: bl  OUTLINED_FUNCTION_0
; CHECK-NEXT: mov lr, r3
; CHECK-NEXT: .cfi_restore lr

define dso_local i32 @y() local_unnamed_addr #0 {
entry:
  %0 = load volatile i32, ptr @a, align 4
  %1 = load volatile i32, ptr @b, align 4
  %2 = load volatile i32, ptr @c, align 4
  %3 = load volatile i32, ptr @d, align 4
  %4 = load volatile i32, ptr @e, align 4
  %5 = load volatile i32, ptr @f, align 4
  %add = add i32 %0, 2
  %add1 = add i32 %add, %1
  %add2 = add i32 %add1, %2
  %add3 = add i32 %add2, %3
  %add4 = add i32 %add3, %4
  %add5 = add i32 %add4, %5
  ret i32 %add5
}
; CHECK-LABEL: y:
; CHECK:      mov r3, lr
; CHECK-NEXT: .cfi_register lr, r3
; CHECK-NEXT: bl  OUTLINED_FUNCTION_0
; CHECK-NEXT: mov lr, r3
; CHECK-NEXT: .cfi_restore lr

attributes #0 = { minsize nofree norecurse nounwind optsize  }