llvm-mirror/test/CodeGen/AArch64/machine-outliner-unsafe-stack-call.mir
Jessica Paquette 387345645f [MachineOutliner] Move stack instr check logic to getOutliningCandidateInfo
This moves the stack check logic into a lambda within getOutliningCandidateInfo.

This allows us to be less conservative with stack checks. Whether or not a
stack instruction is safe to outline is dependent on the frame variant and call
variant of the outlined function; only in cases where we modify the stack can
these be unsafe.

So, if we move that logic later, when we're looking at an individual candidate,
we can make better decisions here.

This gives some code size savings as a result.

llvm-svn: 348220
2018-12-04 00:31:55 +00:00

73 lines
1.9 KiB
YAML

# RUN: llc -mtriple=aarch64--- -run-pass=machine-outliner \
# RUN: -verify-machineinstrs %s -o - | FileCheck %s
# Ensure that we never outline calls into sequences where unsafe stack
# instructions are present.
--- |
define void @foo() #0 { ret void }
define void @bar() #0 { ret void }
define void @baz() #0 { ret void }
define void @f1() #0 { ret void }
define void @f2() #0 { ret void }
attributes #0 = { minsize noinline noredzone "no-frame-pointer-elim"="true" }
...
---
name: f1
tracksRegLiveness: true
body: |
bb.0:
liveins: $lr
; CHECK-LABEL: name: f1
; CHECK: foo
; CHECK-DAG: bar
; CHECK-DAG: baz
$lr = ORRXri $xzr, 1
BL @foo, implicit-def dead $lr, implicit $sp
$x20, $x19 = LDPXi $sp, 255
$x20, $x19 = LDPXi $sp, 255
$x20, $x19 = LDPXi $sp, 255
$x20, $x19 = LDPXi $sp, 255
bb.1:
BL @bar, implicit-def dead $lr, implicit $sp
$x11 = ADDXri $sp, 48, 0;
$x12 = ADDXri $sp, 48, 0;
$x13 = ADDXri $sp, 48, 0;
$x14 = ADDXri $sp, 48, 0;
bb.2:
BL @baz, implicit-def dead $lr, implicit $sp
$x0 = ADDXri $sp, 48, 0;
$x1 = ADDXri $sp, 48, 0;
RET undef $lr
...
---
name: f2
tracksRegLiveness: true
body: |
bb.0:
liveins: $lr
; CHECK-LABEL: name: f2
; CHECK: foo
; CHECK-DAG: bar
; CHECK-DAG: baz
$lr = ORRXri $xzr, 1
BL @foo, implicit-def dead $lr, implicit $sp
$x20, $x19 = LDPXi $sp, 255
$x20, $x19 = LDPXi $sp, 255
$x20, $x19 = LDPXi $sp, 255
$x20, $x19 = LDPXi $sp, 255
bb.1:
BL @bar, implicit-def dead $lr, implicit $sp
$x11 = ADDXri $sp, 48, 0;
$x12 = ADDXri $sp, 48, 0;
$x13 = ADDXri $sp, 48, 0;
$x14 = ADDXri $sp, 48, 0;
bb.2:
BL @baz, implicit-def dead $lr, implicit $sp
$x0 = ADDXri $sp, 48, 0;
$x1 = ADDXri $sp, 48, 0;
RET undef $lr