1 ; RUN: llc < %s -mtriple=thumbv7m -mcpu=cortex-m7 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-BP
2 ; RUN: llc < %s -mtriple=thumbv7m -mcpu=cortex-m3 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NOBP
4 declare void @otherfn()
6 ; CHECK-LABEL: triangle1:
10 define i32 @triangle1(i32 %n, i32* %p) {
12 %tobool = icmp eq i32 %n, 0
13 br i1 %tobool, label %if.end, label %if.then
16 store i32 1, i32* %p, align 4
20 tail call void @otherfn()
24 ; CHECK-LABEL: triangle2:
35 define i32 @triangle2(i32 %n, i32* %p, i32* %q) {
37 %tobool = icmp eq i32 %n, 0
38 br i1 %tobool, label %if.end, label %if.then
41 store i32 1, i32* %p, align 4
42 store i32 2, i32* %q, align 4
46 tail call void @otherfn()
50 ; CHECK-LABEL: triangle3:
58 define i32 @triangle3(i32 %n, i32* %p, i32* %q, i32* %r) {
60 %tobool = icmp eq i32 %n, 0
61 br i1 %tobool, label %if.end, label %if.then
64 store i32 1, i32* %p, align 4
65 store i32 2, i32* %q, align 4
66 store i32 3, i32* %r, align 4
70 tail call void @otherfn()
74 ; CHECK-LABEL: diamond1:
78 define i32 @diamond1(i32 %n, i32* %p) {
80 %tobool = icmp eq i32 %n, 0
81 br i1 %tobool, label %if.else, label %if.then
84 store i32 %n, i32* %p, align 4
88 %0 = load i32, i32* %p, align 4
92 %n.addr.0 = phi i32 [ %n, %if.then ], [ %0, %if.else ]
93 tail call void @otherfn()
97 ; CHECK-LABEL: diamond2:
109 define i32 @diamond2(i32 %n, i32* %p, i32* %q) {
111 %tobool = icmp eq i32 %n, 0
112 br i1 %tobool, label %if.else, label %if.then
115 store i32 %n, i32* %p, align 4
116 %arrayidx = getelementptr inbounds i32, i32* %p, i32 2
117 store i32 %n, i32* %arrayidx, align 4
121 store i32 %n, i32* %q, align 4
126 %n.addr.0 = phi i32 [ %n, %if.then ], [ %0, %if.else ]
127 tail call void @otherfn()
131 ; CHECK-LABEL: diamond3:
139 define i32 @diamond3(i32 %n, i32* %p, i32* %q) {
141 %tobool = icmp eq i32 %n, 0
142 br i1 %tobool, label %if.else, label %if.then
145 store i32 1, i32* %p, align 4
149 %0 = load i32, i32* %p, align 4
150 %1 = load i32, i32* %q, align 4
151 %add = add nsw i32 %1, %0
155 %n.addr.0 = phi i32 [ %n, %if.then ], [ %add, %if.else ]
156 tail call void @otherfn()