9bf8d0d77a9a4c0a7f6a25482a17d68e16026a0f
[oota-llvm.git] / test / CodeGen / MIR / X86 / frame-info-save-restore-points.mir
1 # RUN: llc -march=x86-64 -enable-shrink-wrap=true -start-after shrink-wrap -stop-after shrink-wrap -o /dev/null %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 ---
27 name:            foo
28 tracksRegLiveness: true
29 liveins:
30   - { reg: '%edi' }
31   - { reg: '%esi' }
32 # CHECK: frameInfo:
33 # CHECK:      savePoint: '%bb.2.true'
34 # CHECK-NEXT: restorePoint: '%bb.2.true'
35 # CHECK: stack
36 frameInfo:
37   maxAlignment:  4
38   hasCalls:      true
39   savePoint:     '%bb.2.true'
40   restorePoint:  '%bb.2.true'
41 stack:
42   - { id: 0, name: tmp, offset: 0, size: 4, alignment: 4 }
43 body:
44   - id:          0
45     successors:  [ '%bb.2.true', '%bb.1' ]
46     liveins:     [ '%edi', '%esi' ]
47     instructions:
48       - '%eax = COPY %edi'
49       - 'CMP32rr %eax, killed %esi, implicit-def %eflags'
50       - 'JL_1 %bb.2.true, implicit killed %eflags'
51   - id:          1
52     successors:  [ '%bb.3.false' ]
53     liveins:     [ '%eax' ]
54     instructions:
55       - 'JMP_1 %bb.3.false'
56   - id:          2
57     name:        'true'
58     successors:  [ '%bb.3.false' ]
59     liveins:     [ '%eax' ]
60     instructions:
61       - 'MOV32mr %stack.0.tmp, 1, _, 0, _, killed %eax'
62       - 'ADJCALLSTACKDOWN64 0, 0, implicit-def %rsp, implicit-def dead %eflags, implicit %rsp'
63       - '%rsi = LEA64r %stack.0.tmp, 1, _, 0, _'
64       - '%edi = MOV32r0 implicit-def dead %eflags'
65       - 'CALL64pcrel32 @doSomething, csr_64, implicit %rsp, implicit %edi, implicit %rsi, implicit-def %rsp, implicit-def %eax'
66       - 'ADJCALLSTACKUP64 0, 0, implicit-def %rsp, implicit-def dead %eflags, implicit %rsp'
67   - id:          3
68     name:        'false'
69     liveins:     [ '%eax' ]
70     instructions:
71       - 'RETQ %eax'
72 ...