1 ; RUN: llc < %s -mtriple thumbv7s-apple-darwin -asm-verbose=false | FileCheck %s
2 ; RUN: llc < %s -mtriple thumbv7s-apple-darwin -asm-verbose=false -print-machineinstrs=if-converter 2>&1 | FileCheck --check-prefix=CHECK-WEIGHT %s
5 declare i8* @bar(i32, i8*, i8*)
7 ; Verify that we don't try to iteratively re-ifconvert a block with a
8 ; (predicated) indirectbr terminator.
9 ; If we do, we would ignore its fallthrough successor.
13 ; CHECK: cmp {{.*}}, #21
16 ; CHECK-NEXT: moveq pc
17 ; CHECK-NEXT: LBB{{[0-9_]+}}:
18 ; CHECK-NEXT: cmp {{.*}}, #42
21 ; CHECK-NEXT: movne pc
24 ; CHECK-NEXT: movw r0, #1234
25 ; CHECK-NEXT: b [[FOOCALL:LBB[0-9_]+]]
27 ; CHECK-NEXT: LBB{{[0-9_]+}}:
28 ; CHECK-NEXT: movw r0, #4567
29 ; CHECK-NEXT: [[FOOCALL]]:
30 ; CHECK-NEXT: blx _foo
33 ; CHECK-WEIGHT: Successors according to CFG: BB#1(16) BB#2(8) BB#4(8)
35 ; CHECK-WEIGHT: Successors according to CFG: BB#2(24) BB#4(8)
37 define i32 @test(i32 %a, i32 %a2, i32* %p, i32* %p2) {
39 %dst1 = call i8* @bar(i32 1, i8* blockaddress(@test, %bb1), i8* blockaddress(@test, %bb2))
40 %dst2 = call i8* @bar(i32 2, i8* blockaddress(@test, %bb1), i8* blockaddress(@test, %bb2))
41 %dst3 = call i8* @bar(i32 3, i8* blockaddress(@test, %bb1), i8* blockaddress(@test, %bb2))
42 %cc1 = icmp eq i32 %a, 21
43 br i1 %cc1, label %cc1t, label %cc1f
47 indirectbr i8* %dst3, [label %bb1, label %bb2]
50 %cc2 = icmp ne i32 %a2, 42
51 br i1 %cc2, label %cc2t, label %bb1
53 store i32 %a, i32* %p2
54 indirectbr i8* %dst1, [label %bb1, label %bb2]
57 %ret_bb1 = call i32 @foo(i32 1234)
60 %ret_bb2 = call i32 @foo(i32 4567)