2016-07-16 10:24:59 +08:00
|
|
|
# RUN: llc -march=x86-64 -run-pass none -o - %s | FileCheck %s
|
2015-07-30 05:09:09 +08:00
|
|
|
# This test ensures that the MIR parser parses the save and restore points in
|
|
|
|
# the machine frame info correctly.
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
|
|
|
define i32 @foo(i32 %a, i32 %b) {
|
|
|
|
entry:
|
|
|
|
%tmp = alloca i32, align 4
|
|
|
|
%tmp2 = icmp slt i32 %a, %b
|
|
|
|
br i1 %tmp2, label %true, label %false
|
|
|
|
|
|
|
|
true:
|
|
|
|
store i32 %a, i32* %tmp, align 4
|
|
|
|
%tmp4 = call i32 @doSomething(i32 0, i32* %tmp)
|
|
|
|
br label %false
|
|
|
|
|
|
|
|
false:
|
|
|
|
%tmp.0 = phi i32 [ %tmp4, %true ], [ %a, %entry ]
|
|
|
|
ret i32 %tmp.0
|
|
|
|
}
|
|
|
|
|
|
|
|
declare i32 @doSomething(i32, i32*)
|
|
|
|
|
|
|
|
...
|
|
|
|
---
|
|
|
|
name: foo
|
|
|
|
tracksRegLiveness: true
|
|
|
|
liveins:
|
2018-02-01 06:04:26 +08:00
|
|
|
- { reg: '$edi' }
|
|
|
|
- { reg: '$esi' }
|
2015-07-30 05:09:09 +08:00
|
|
|
# CHECK: frameInfo:
|
2017-12-05 01:18:51 +08:00
|
|
|
# CHECK: savePoint: '%bb.2'
|
|
|
|
# CHECK-NEXT: restorePoint: '%bb.2'
|
2015-07-30 05:09:09 +08:00
|
|
|
# CHECK: stack
|
|
|
|
frameInfo:
|
|
|
|
maxAlignment: 4
|
|
|
|
hasCalls: true
|
2017-12-05 01:18:51 +08:00
|
|
|
savePoint: '%bb.2'
|
|
|
|
restorePoint: '%bb.2'
|
2015-07-30 05:09:09 +08:00
|
|
|
stack:
|
|
|
|
- { id: 0, name: tmp, offset: 0, size: 4, alignment: 4 }
|
2015-08-14 07:10:16 +08:00
|
|
|
body: |
|
|
|
|
bb.0:
|
2017-12-05 01:18:51 +08:00
|
|
|
successors: %bb.2, %bb.1
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $edi, $esi
|
2015-08-14 07:10:16 +08:00
|
|
|
|
2018-02-01 06:04:26 +08:00
|
|
|
$eax = COPY $edi
|
|
|
|
CMP32rr $eax, killed $esi, implicit-def $eflags
|
|
|
|
JL_1 %bb.2, implicit killed $eflags
|
2015-08-14 07:10:16 +08:00
|
|
|
|
|
|
|
bb.1:
|
2017-12-05 01:18:51 +08:00
|
|
|
successors: %bb.3
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $eax
|
2015-08-14 07:10:16 +08:00
|
|
|
|
2017-12-05 01:18:51 +08:00
|
|
|
JMP_1 %bb.3
|
2015-08-14 07:10:16 +08:00
|
|
|
|
|
|
|
bb.2.true:
|
2017-12-05 01:18:51 +08:00
|
|
|
successors: %bb.3
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $eax
|
2015-08-14 07:10:16 +08:00
|
|
|
|
2018-02-01 06:04:26 +08:00
|
|
|
MOV32mr %stack.0.tmp, 1, _, 0, _, killed $eax
|
|
|
|
ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $ssp, implicit-def dead $eflags, implicit $rsp, implicit $ssp
|
|
|
|
$rsi = LEA64r %stack.0.tmp, 1, _, 0, _
|
|
|
|
$edi = MOV32r0 implicit-def dead $eflags
|
|
|
|
CALL64pcrel32 @doSomething, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit $rsi, implicit-def $rsp, implicit-def $ssp, implicit-def $eax
|
|
|
|
ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $ssp, implicit-def dead $eflags, implicit $rsp, implicit $ssp
|
2015-08-14 07:10:16 +08:00
|
|
|
|
|
|
|
bb.3.false:
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $eax
|
2015-08-14 07:10:16 +08:00
|
|
|
|
2018-02-01 06:04:26 +08:00
|
|
|
RETQ $eax
|
2015-07-30 05:09:09 +08:00
|
|
|
...
|