de4f84eb210dc6ea8a1cf5fb04a13a871f85939e
[oota-llvm.git] / test / CodeGen / MIR / X86 / successor-basic-blocks.mir
1 # RUN: llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s | FileCheck %s
2 # This test ensures that the MIR parser parses basic block successors correctly.
3
4 --- |
5
6   define i32 @foo(i32 %a) {
7   entry:
8     %0 = icmp sle i32 %a, 10
9     br i1 %0, label %less, label %exit
10
11   less:
12     ret i32 0
13
14   exit:
15     ret i32 %a
16   }
17
18   define i32 @bar(i32 %a) {
19   entry:
20     %b = icmp sle i32 %a, 10
21     br i1 %b, label %0, label %1
22
23   ; <label>:0
24     ret i32 0
25
26   ; <label>:1
27     ret i32 %a
28   }
29
30 ...
31 ---
32 name:            foo
33 body:
34   # CHECK: name: entry
35   # CHECK: successors: [ '%bb.1.less', '%bb.2.exit' ]
36   # CHECK: name: less
37   - id:          0
38     name:        entry
39     successors:  [ '%bb.1.less', '%bb.2.exit' ]
40     liveins:     [ '%edi' ]
41     instructions:
42       - 'CMP32ri8 %edi, 10, implicit-def %eflags'
43       - 'JG_1 %bb.2.exit, implicit killed %eflags'
44   - id:          1
45     name:        less
46     instructions:
47       - '%eax = MOV32r0 implicit-def dead %eflags'
48       - 'RETQ killed %eax'
49   - id:          2
50     name:        exit
51     liveins:     [ '%edi' ]
52     instructions:
53       - '%eax = COPY killed %edi'
54       - 'RETQ killed %eax'
55 ...
56 ---
57 name:            bar
58 body:
59   # CHECK: name: bar
60   # CHECK: name: entry
61   # CHECK: successors: [ '%bb.1', '%bb.2' ]
62   # CHECK: id: 1
63   # CHECK: id: 2
64   - id:           0
65     name:         entry
66     successors:   [ '%bb.1', '%bb.2' ]
67     liveins:      [ '%edi' ]
68     instructions:
69       - 'CMP32ri8 %edi, 10, implicit-def %eflags'
70       - 'JG_1 %bb.2, implicit killed %eflags'
71   - id:           1
72     instructions:
73       - '%eax = MOV32r0 implicit-def dead %eflags'
74       - 'RETQ killed %eax'
75   - id:           2
76     liveins:      [ '%edi' ]
77     instructions:
78       - '%eax = COPY killed %edi'
79       - 'RETQ killed %eax'
80 ...