MIR Parser: Report an error when a fixed stack object is redefined.
[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   - id:              0
40     name:            entry
41     successors:      [ '%bb.2.def', '%bb.1.entry' ]
42     instructions:
43       - '%eax = MOV32rr %edi, implicit-def %rax'
44       - 'CMP32ri8 %edi, 3, implicit-def %eflags'
45       - 'JA_1 %bb.2.def, implicit %eflags'
46   - id:              1
47     name:            entry
48     successors:      [ '%bb.3.lbl1', '%bb.4.lbl2', '%bb.5.lbl3', '%bb.6.lbl4' ]
49     instructions:
50     # CHECK: [[@LINE+1]]:36: use of undefined jump table '%jump-table.2'
51       - '%rcx = LEA64r %rip, 1, _, %jump-table.2, _'
52       - '%rax = MOVSX64rm32 %rcx, 4, %rax, 0, _'
53       - '%rax = ADD64rr %rax, %rcx, implicit-def %eflags'
54       - 'JMP64r %rax'
55   - id:              2
56     name:            def
57     instructions:
58       - '%eax = MOV32r0 implicit-def %eflags'
59       - 'RETQ %eax'
60   - id:              3
61     name:            lbl1
62     instructions:
63       - '%eax = MOV32ri 1'
64       - 'RETQ %eax'
65   - id:              4
66     name:            lbl2
67     instructions:
68       - '%eax = MOV32ri 2'
69       - 'RETQ %eax'
70   - id:              5
71     name:            lbl3
72     instructions:
73       - '%eax = MOV32ri 4'
74       - 'RETQ %eax'
75   - id:              6
76     name:            lbl4
77     instructions:
78       - '%eax = MOV32ri 8'
79       - 'RETQ %eax'
80 ...