xref: /llvm-project/llvm/test/CodeGen/ARM/jump-table-islands.ll (revision fc6bdb8549842613da51b9d570b29e27cc709f69)
1; RUN: llc -mtriple=armv7-apple-ios8.0 -o - %s | FileCheck %s
2
3%BigInt = type i8500
4
5declare void @use(%BigInt)
6
7define %BigInt @test_moved_jumptable(i1 %tst, i32 %sw, %BigInt %l) {
8; CHECK-LABEL: test_moved_jumptable:
9
10; CHECK:   adr {{r[0-9]+}}, [[JUMP_TABLE:LJTI[0-9]+_[0-9]+]]
11; CHECK:   b [[SKIP_TABLE:LBB[0-9]+_[0-9]+]]
12
13; CHECK: [[JUMP_TABLE]]:
14; CHECK:   .data_region jt32
15; CHECK:   .long LBB{{[0-9]+_[0-9]+}}-[[JUMP_TABLE]]
16
17; CHECK: [[SKIP_TABLE]]:
18; CHECK:   add pc, {{r[0-9]+|lr}}, {{r[0-9]+|lr}}
19  br i1 %tst, label %simple, label %complex
20
21simple:
22  br label %end
23
24complex:
25  switch i32 %sw, label %simple [ i32 0, label %other
26                                  i32 1, label %third
27                                  i32 5, label %end
28                                  i32 6, label %other ]
29
30third:
31  ret %BigInt 0
32
33other:
34  call void @bar()
35  unreachable
36
37end:
38  %val = phi %BigInt [ %l, %complex ], [ -1, %simple ]
39; Prevent SimplifyCFG from simplifying the phi node above.
40  call void @use(%BigInt %val)
41  ret %BigInt %val
42}
43
44declare void @bar()
45