MIR Serialization: Serialize MMI's variable debug information.
[oota-llvm.git] / test / CodeGen / MIR / X86 / undefined-jump-table-id.mir
1 # RUN: not llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s
2
3 --- |
4
5   define i32 @test_jumptable(i32 %in) {
6   entry:
7     switch i32 %in, label %def [
8       i32 0, label %lbl1
9       i32 1, label %lbl2
10       i32 2, label %lbl3
11       i32 3, label %lbl4
12     ]
13
14   def:
15     ret i32 0
16
17   lbl1:
18     ret i32 1
19
20   lbl2:
21     ret i32 2
22
23   lbl3:
24     ret i32 4
25
26   lbl4:
27     ret i32 8
28   }
29
30 ...
31 ---
32 name:            test_jumptable
33 jumpTable:
34   kind:          label-difference32
35   entries:
36     - id:        0
37       blocks:    [ '%bb.3.lbl1', '%bb.4.lbl2', '%bb.5.lbl3', '%bb.6.lbl4' ]
38 body: |
39   bb.0.entry:
40     successors: %bb.2.def, %bb.1.entry
41
42     %eax = MOV32rr %edi, implicit-def %rax
43     CMP32ri8 %edi, 3, implicit-def %eflags
44     JA_1 %bb.2.def, implicit %eflags
45
46   bb.1.entry:
47     successors: %bb.3.lbl1, %bb.4.lbl2, %bb.5.lbl3, %bb.6.lbl4
48     ; CHECK: [[@LINE+1]]:31: use of undefined jump table '%jump-table.2'
49     %rcx = LEA64r %rip, 1, _, %jump-table.2, _
50     %rax = MOVSX64rm32 %rcx, 4, %rax, 0, _
51     %rax = ADD64rr %rax, %rcx, implicit-def %eflags
52     JMP64r %rax
53
54   bb.2.def:
55     %eax = MOV32r0 implicit-def %eflags
56     RETQ %eax
57
58   bb.3.lbl1:
59     %eax = MOV32ri 1
60     RETQ %eax
61
62   bb.4.lbl2:
63     %eax = MOV32ri 2
64     RETQ %eax
65
66   bb.5.lbl3:
67     %eax = MOV32ri 4
68     RETQ %eax
69
70   bb.6.lbl4:
71     %eax = MOV32ri 8
72     RETQ %eax
73 ...