MIR Serialization: Serialize the '.cfi_offset' CFI instruction.
[oota-llvm.git] / test / CodeGen / MIR / X86 / cfi-offset.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 the .cfi_offset operands
3 # correctly.
4
5 --- |
6
7   declare void @foo(i32)
8
9   define i32 @test(i32 %a, i32 %b, i32 %c, i32 %d) {
10   entry:
11     %add = add nsw i32 %b, %a
12     %add1 = add nsw i32 %add, %c
13     %add2 = add nsw i32 %add1, %d
14     tail call void @foo(i32 %add2)
15     %add6 = add nsw i32 %add2, %add2
16     ret i32 %add6
17   }
18
19 ...
20 ---
21 name:            test
22 tracksRegLiveness: true
23 frameInfo:
24   stackSize:       8
25   adjustsStack:    true
26   hasCalls:        true
27 fixedStack:
28   - { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16 }
29 body:
30   - id:              0
31     name:            entry
32     instructions:
33       - 'PUSH64r killed %rbx, implicit-def %rsp, implicit %rsp'
34       - 'CFI_INSTRUCTION .cfi_def_cfa_offset 16'
35       # CHECK: CFI_INSTRUCTION .cfi_offset %rbx, -16
36       - 'CFI_INSTRUCTION .cfi_offset %rbx, -16'
37       - '%ebx = COPY %edi, implicit-def %rbx'
38       - '%ebx = ADD32rr %ebx, killed %esi, implicit-def dead %eflags'
39       - '%ebx = ADD32rr %ebx, killed %edx, implicit-def dead %eflags'
40       - '%ebx = ADD32rr %ebx, killed %ecx, implicit-def dead %eflags'
41       - '%edi = COPY %ebx'
42       - 'CALL64pcrel32 @foo, csr_64, implicit %rsp, implicit %edi, implicit-def %rsp'
43       - '%eax = LEA64_32r killed %rbx, 1, %rbx, 0, _'
44       - '%rbx = POP64r implicit-def %rsp, implicit %rsp'
45       - 'RETQ %eax'
46 ...
47