• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -mtriple thumbv7s-apple-darwin  -asm-verbose=false | FileCheck %s
2
3declare i32 @foo(i32)
4declare i8* @bar(i32, i8*, i8*)
5
6; Verify that we don't try to iteratively re-ifconvert a block with a
7; (predicated) indirectbr terminator.
8; If we do, we would ignore its fallthrough successor.
9
10
11; CHECK-LABEL: test:
12; CHECK:       cmp {{.*}}, #21
13; CHECK-NEXT:  itt eq
14; CHECK-NEXT:  streq.w
15; CHECK-NEXT:  moveq pc
16; CHECK-NEXT: LBB{{[0-9_]+}}:
17; CHECK-NEXT:  cmp {{.*}}, #42
18; CHECK-NEXT:  itt ne
19; CHECK-NEXT:  strne.w
20; CHECK-NEXT:  movne pc
21; CHECK-NEXT: Ltmp
22; CHECK-NEXT: LBB0_2:
23; CHECK-NEXT:  movw r0, #1234
24; CHECK-NEXT:  b [[FOOCALL:LBB[0-9_]+]]
25; CHECK-NEXT: Ltmp
26; CHECK-NEXT: LBB{{[0-9_]+}}:
27; CHECK-NEXT:  movw r0, #4567
28; CHECK-NEXT: [[FOOCALL]]:
29; CHECK-NEXT:  blx _foo
30
31define i32 @test(i32 %a, i32 %a2, i32* %p, i32* %p2) {
32entry:
33  %dst1 = call i8* @bar(i32 1, i8* blockaddress(@test, %bb1), i8* blockaddress(@test, %bb2))
34  %dst2 = call i8* @bar(i32 2, i8* blockaddress(@test, %bb1), i8* blockaddress(@test, %bb2))
35  %dst3 = call i8* @bar(i32 3, i8* blockaddress(@test, %bb1), i8* blockaddress(@test, %bb2))
36  %cc1 = icmp eq i32 %a, 21
37  br i1 %cc1, label %cc1t, label %cc1f
38
39cc1t:
40  store i32 %a, i32* %p
41  indirectbr i8* %dst3, [label %bb1, label %bb2]
42
43cc1f:
44  %cc2 = icmp ne i32 %a2, 42
45  br i1 %cc2, label %cc2t, label %bb1
46cc2t:
47  store i32 %a, i32* %p2
48  indirectbr i8* %dst1, [label %bb1, label %bb2]
49
50bb1:
51  %ret_bb1 = call i32 @foo(i32 1234)
52  ret i32 %ret_bb1
53bb2:
54  %ret_bb2 = call i32 @foo(i32 4567)
55  ret i32 %ret_bb2
56}
57