MIR Serialization: Serialize the jump table info.
[oota-llvm.git] / test / CodeGen / MIR / X86 / jump-table-info.mir
1 # RUN: llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s | FileCheck %s
2 # This test ensures that the MIR parser parses the jump table info correctly.
3
4 --- |
5
6   define i32 @test_jumptable(i32 %in) {
7   entry:
8     switch i32 %in, label %def [
9       i32 0, label %lbl1
10       i32 1, label %lbl2
11       i32 2, label %lbl3
12       i32 3, label %lbl4
13     ]
14
15   def:
16     ret i32 0
17
18   lbl1:
19     ret i32 1
20
21   lbl2:
22     ret i32 2
23
24   lbl3:
25     ret i32 4
26
27   lbl4:
28     ret i32 8
29   }
30
31 ...
32 ---
33 name:            test_jumptable
34 # CHECK:      jumpTable:
35 # CHECK-NEXT: kind: label-difference32
36 # CHECK-NEXT: entries:
37 # CHECK-NEXT: - id: 0
38 # CHECK-NEXT: blocks: [ '%bb.3.lbl1', '%bb.4.lbl2', '%bb.5.lbl3', '%bb.6.lbl4' ]
39 # CHECK_NEXT: body:
40 jumpTable:
41   kind:          label-difference32
42   entries:
43     - id:        0
44       blocks:    [ '%bb.3.lbl1', '%bb.4.lbl2', '%bb.5.lbl3', '%bb.6.lbl4' ]
45 body:
46   - id:          0
47     name:        entry
48     successors:  [ '%bb.2.def', '%bb.1.entry' ]
49   - id:          1
50     name:        entry
51     successors:  [ '%bb.3.lbl1', '%bb.4.lbl2', '%bb.5.lbl3', '%bb.6.lbl4' ]
52   - id:          2
53     name:        def
54   - id:          3
55     name:        lbl1
56   - id:          4
57     name:        lbl2
58   - id:          5
59     name:        lbl3
60   - id:          6
61     name:        lbl4
62 ...