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-PROB %s 3 4 declare i32 @foo(i32) 5 declare i8* @bar(i32, i8*, i8*) 6 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. 10 11 12 ; CHECK-LABEL: test: 13 ; CHECK: cmp {{.*}}, #21 14 ; CHECK-NEXT: itt eq 15 ; CHECK-NEXT: streq.w 16 ; CHECK-NEXT: moveq pc 17 ; CHECK-NEXT: LBB{{[0-9_]+}}: 18 ; CHECK-NEXT: cmp {{.*}}, #42 19 ; CHECK-NEXT: itt ne 20 ; CHECK-NEXT: strne.w 21 ; CHECK-NEXT: movne pc 22 ; CHECK-NEXT: Ltmp 23 ; CHECK-NEXT: LBB0_2: 24 ; CHECK-NEXT: movw r0, #1234 25 ; CHECK-NEXT: b [[FOOCALL:LBB[0-9_]+]] 26 ; CHECK-NEXT: Ltmp 27 ; CHECK-NEXT: LBB{{[0-9_]+}}: 28 ; CHECK-NEXT: movw r0, #4567 29 ; CHECK-NEXT: [[FOOCALL]]: 30 ; CHECK-NEXT: blx _foo 31 ; 32 ; CHECK-PROB: BB#0: 33 ; CHECK-PROB: Successors according to CFG: BB#1({{[0-9a-fx/= ]+}}50.00%) BB#2({{[0-9a-fx/= ]+}}25.00%) BB#4({{[0-9a-fx/= ]+}}25.00%) 34 ; CHECK-PROB: BB#1: 35 ; CHECK-PROB: Successors according to CFG: BB#2({{[0-9a-fx/= ]+}}75.00%) BB#4({{[0-9a-fx/= ]+}}25.00%) 36 37 define i32 @test(i32 %a, i32 %a2, i32* %p, i32* %p2) { 38 entry: 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 44 45 cc1t: 46 store i32 %a, i32* %p 47 indirectbr i8* %dst3, [label %bb1, label %bb2] 48 49 cc1f: 50 %cc2 = icmp ne i32 %a2, 42 51 br i1 %cc2, label %cc2t, label %bb1 52 cc2t: 53 store i32 %a, i32* %p2 54 indirectbr i8* %dst1, [label %bb1, label %bb2] 55 56 bb1: 57 %ret_bb1 = call i32 @foo(i32 1234) 58 ret i32 %ret_bb1 59 bb2: 60 %ret_bb2 = call i32 @foo(i32 4567) 61 ret i32 %ret_bb2 62 } 63