1# RUN: llc -march=x86-64 -run-pass none -o - %s | FileCheck %s
2# This test ensures that the MIR parser parses the save and restore points in
3# the machine frame info correctly.
4
5--- |
6
7  define i32 @foo(i32 %a, i32 %b) {
8  entry:
9    %tmp = alloca i32, align 4
10    %tmp2 = icmp slt i32 %a, %b
11    br i1 %tmp2, label %true, label %false
12
13  true:
14    store i32 %a, i32* %tmp, align 4
15    %tmp4 = call i32 @doSomething(i32 0, i32* %tmp)
16    br label %false
17
18  false:
19    %tmp.0 = phi i32 [ %tmp4, %true ], [ %a, %entry ]
20    ret i32 %tmp.0
21  }
22
23  declare i32 @doSomething(i32, i32*)
24
25...
26---
27name:            foo
28tracksRegLiveness: true
29liveins:
30  - { reg: '$edi' }
31  - { reg: '$esi' }
32# CHECK: frameInfo:
33# CHECK:      savePoint: '%bb.2'
34# CHECK-NEXT: restorePoint: '%bb.2'
35# CHECK: stack
36frameInfo:
37  maxAlignment:  4
38  hasCalls:      true
39  savePoint:     '%bb.2'
40  restorePoint:  '%bb.2'
41stack:
42  - { id: 0, name: tmp, offset: 0, size: 4, alignment: 4 }
43body: |
44  bb.0:
45    successors: %bb.2, %bb.1
46    liveins: $edi, $esi
47
48    $eax = COPY $edi
49    CMP32rr $eax, killed $esi, implicit-def $eflags
50    JCC_1 %bb.2, 12, implicit killed $eflags
51
52  bb.1:
53    successors: %bb.3
54    liveins: $eax
55
56    JMP_1 %bb.3
57
58  bb.2.true:
59    successors: %bb.3
60    liveins: $eax
61
62    MOV32mr %stack.0.tmp, 1, _, 0, _, killed $eax
63    ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $ssp, implicit-def dead $eflags, implicit $rsp, implicit $ssp
64    $rsi = LEA64r %stack.0.tmp, 1, _, 0, _
65    $edi = MOV32r0 implicit-def dead $eflags
66    CALL64pcrel32 @doSomething, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit $rsi, implicit-def $rsp, implicit-def $ssp, implicit-def $eax
67    ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $ssp, implicit-def dead $eflags, implicit $rsp, implicit $ssp
68
69  bb.3.false:
70    liveins: $eax
71
72    RETQ $eax
73...
74