1 ; RUN: llc < %s -mtriple=thumbv7m -mattr=-no-branch-predictor | 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, ptr %p) {
12 %tobool = icmp eq i32 %n, 0
13 br i1 %tobool, label %if.end, label %if.then
16 store i32 1, ptr %p, align 4
20 tail call void @otherfn()
24 ; CHECK-LABEL: triangle2:
35 define i32 @triangle2(i32 %n, ptr %p, ptr %q) {
37 %tobool = icmp eq i32 %n, 0
38 br i1 %tobool, label %if.end, label %if.then
41 store i32 1, ptr %p, align 4
42 store i32 2, ptr %q, align 4
46 tail call void @otherfn()
50 ; CHECK-LABEL: triangle3:
58 define i32 @triangle3(i32 %n, ptr %p, ptr %q, ptr %r) {
60 %tobool = icmp eq i32 %n, 0
61 br i1 %tobool, label %if.end, label %if.then
64 store i32 1, ptr %p, align 4
65 store i32 2, ptr %q, align 4
66 store i32 3, ptr %r, align 4
67 store i32 4, ptr %p, align 4
71 tail call void @otherfn()
75 ; CHECK-LABEL: diamond1:
79 define i32 @diamond1(i32 %n, ptr %p) {
81 %tobool = icmp eq i32 %n, 0
82 br i1 %tobool, label %if.else, label %if.then
85 store i32 %n, ptr %p, align 4
89 %0 = load i32, ptr %p, align 4
93 %n.addr.0 = phi i32 [ %n, %if.then ], [ %0, %if.else ]
94 tail call void @otherfn()
98 ; CHECK-LABEL: diamond2:
110 define i32 @diamond2(i32 %n, ptr %p, ptr %q) {
112 %tobool = icmp eq i32 %n, 0
113 br i1 %tobool, label %if.else, label %if.then
116 store i32 %n, ptr %p, align 4
117 %arrayidx = getelementptr inbounds i32, ptr %p, i32 2
118 store i32 %n, ptr %arrayidx, align 4
122 store i32 %n, ptr %q, align 4
127 %n.addr.0 = phi i32 [ %n, %if.then ], [ %0, %if.else ]
128 tail call void @otherfn()
132 ; CHECK-LABEL: diamond3:
140 define i32 @diamond3(i32 %n, ptr %p, ptr %q) {
142 %tobool = icmp eq i32 %n, 0
143 br i1 %tobool, label %if.else, label %if.then
146 store i32 1, ptr %p, align 4
150 %0 = load i32, ptr %p, align 4
151 %1 = load i32, ptr %q, align 4
152 %add = add nsw i32 %1, %0
156 %n.addr.0 = phi i32 [ %n, %if.then ], [ %add, %if.else ]
157 tail call void @otherfn()