1# RUN: llc -march=x86-64 -run-pass none -o - %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---
32name:            foo
33body: |
34  ; CHECK-LABEL: bb.0.entry:
35  ; CHECK-LABEL: bb.1.less:
36  bb.0.entry:
37    successors: %bb.1.less, %bb.2.exit
38    liveins: $edi
39
40    CMP32ri8 $edi, 10, implicit-def $eflags
41    JCC_1 %bb.2.exit, 15, implicit killed $eflags
42
43  bb.1.less:
44    $eax = MOV32r0 implicit-def dead $eflags
45    RETQ killed $eax
46
47  bb.2.exit:
48    liveins: $edi
49
50    $eax = COPY killed $edi
51    RETQ killed $eax
52...
53---
54name:            bar
55body: |
56  ; CHECK-LABEL: name: bar
57  ; Verify that we can have multiple lists of successors that will be merged
58  ; into one.
59  ; CHECK-LABEL: bb.0.entry:
60  ; CHECK:         successors: %bb.1(0x80000000), %bb.2(0x00000000)
61  bb.0.entry:
62    liveins: $edi
63    successors: %bb.1
64    successors: %bb.2
65
66    CMP32ri8 $edi, 10, implicit-def $eflags
67    JCC_1 %bb.2, 15, implicit killed $eflags
68
69  ; Verify that we can have an empty list of successors.
70  ; CHECK-LABEL: bb.1:
71  ; CHECK-NEXT:  $eax = MOV32r0 implicit-def dead $eflags
72  bb.1:
73    successors:
74    $eax = MOV32r0 implicit-def dead $eflags
75    RETQ killed $eax
76
77  bb.2:
78    liveins: $edi
79
80    $eax = COPY killed $edi
81    RETQ killed $eax
82...
83