1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=thumbv8m.main-none-none-eabi %s -o - -verify-machineinstrs | FileCheck %s
4 declare i32 @fn(i32) #0
6 define i32 @f1(i32 %a) #0 {
8 ; CHECK: @ %bb.0: @ %entry
9 ; CHECK-NEXT: .save {r4, lr}
10 ; CHECK-NEXT: push {r4, lr}
11 ; CHECK-NEXT: mov r4, r0
13 ; CHECK-NEXT: movs r0, #0
14 ; CHECK-NEXT: cbz r4, .LBB0_2
15 ; CHECK-NEXT: @ %bb.1: @ %return
16 ; CHECK-NEXT: pop {r4, pc}
17 ; CHECK-NEXT: .LBB0_2: @ %if.end
19 ; CHECK-NEXT: adds r0, #1
20 ; CHECK-NEXT: pop {r4, pc}
22 %call = tail call i32 @fn(i32 %a) #2
23 %tobool = icmp eq i32 %a, 0
24 br i1 %tobool, label %if.end, label %return
26 if.end: ; preds = %entry
27 %call1 = tail call i32 @fn(i32 0) #2
28 %add = add nsw i32 %call1, 1
31 return: ; preds = %entry, %if.end
32 %retval.0 = phi i32 [ %add, %if.end ], [ 0, %entry ]
36 define i32 @f2(i32 %a) #0 {
38 ; CHECK: @ %bb.0: @ %entry
39 ; CHECK-NEXT: .save {r4, lr}
40 ; CHECK-NEXT: push {r4, lr}
41 ; CHECK-NEXT: mov r4, r0
43 ; CHECK-NEXT: movs r0, #0
44 ; CHECK-NEXT: cmp r4, #1
45 ; CHECK-NEXT: bne .LBB1_2
46 ; CHECK-NEXT: @ %bb.1: @ %if.end
48 ; CHECK-NEXT: adds r0, #1
49 ; CHECK-NEXT: .LBB1_2: @ %return
50 ; CHECK-NEXT: pop {r4, pc}
52 %call = tail call i32 @fn(i32 %a) #2
53 %tobool = icmp eq i32 %a, 1
54 br i1 %tobool, label %if.end, label %return
56 if.end: ; preds = %entry
57 %call1 = tail call i32 @fn(i32 0) #2
58 %add = add nsw i32 %call1, 1
61 return: ; preds = %entry, %if.end
62 %retval.0 = phi i32 [ %add, %if.end ], [ 0, %entry ]
66 define void @f3(i32 %x) #0 {
68 ; CHECK: @ %bb.0: @ %entry
69 ; CHECK-NEXT: cmp r0, #1
70 ; CHECK-NEXT: bne .LBB2_2
71 ; CHECK-NEXT: @ %bb.1: @ %t
72 ; CHECK-NEXT: .save {r7, lr}
73 ; CHECK-NEXT: push {r7, lr}
74 ; CHECK-NEXT: movs r0, #0
76 ; CHECK-NEXT: pop.w {r7, lr}
77 ; CHECK-NEXT: .LBB2_2: @ %f
80 %p = icmp eq i32 %x, 1
81 br i1 %p, label %t, label %f
91 attributes #0 = { minsize nounwind optsize }