2019-12-08 02:23:30 +08:00
|
|
|
# RUN: llc -mtriple=aarch64--- -run-pass=prologepilog -run-pass=machine-outliner -verify-machineinstrs -frame-pointer=non-leaf %s -o - | FileCheck %s
|
2017-08-09 05:51:26 +08:00
|
|
|
--- |
|
2017-09-28 04:47:39 +08:00
|
|
|
|
2018-01-11 02:49:57 +08:00
|
|
|
@x = common global i32 0, align 4
|
|
|
|
|
2017-12-19 03:33:21 +08:00
|
|
|
define void @baz() #0 {
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-08-09 05:51:26 +08:00
|
|
|
define i32 @main() #0 {
|
|
|
|
ret i32 0
|
|
|
|
}
|
2018-12-02 05:23:58 +08:00
|
|
|
|
2017-09-28 04:47:39 +08:00
|
|
|
define void @bar(i32 %a) #0 {
|
|
|
|
ret void
|
|
|
|
}
|
2018-12-02 05:23:58 +08:00
|
|
|
|
2019-12-09 21:09:58 +08:00
|
|
|
attributes #0 = { noinline noredzone }
|
2017-08-09 05:51:26 +08:00
|
|
|
...
|
|
|
|
---
|
|
|
|
# This test ensures that we
|
|
|
|
# - Create outlined functions
|
|
|
|
# - Don't outline anything to do with LR or W30
|
2017-09-28 04:47:39 +08:00
|
|
|
# - Save LR when it's not available
|
2018-01-13 08:42:28 +08:00
|
|
|
# - Functions whose addresses are taken can still be outlined
|
2017-08-09 05:51:26 +08:00
|
|
|
#
|
2018-12-02 05:24:06 +08:00
|
|
|
# CHECK-LABEL: main
|
|
|
|
# CHECK-LABEL: bb.1:
|
|
|
|
# CHECK-DAG: BL @OUTLINED_FUNCTION_[[F0:[0-9]+]]
|
2018-07-31 01:45:28 +08:00
|
|
|
# CHECK-NEXT: $lr = ORRXrs $xzr, $x[[REG:[0-9]+]], 0
|
2018-12-02 05:23:58 +08:00
|
|
|
# CHECK-NEXT: STRHHroW $w12, $x9, $w30, 1, 1
|
2018-02-01 06:04:26 +08:00
|
|
|
# CHECK-NEXT: $lr = ORRXri $xzr, 1
|
[MachineOutliner] AArch64: Handle instrs that use SP and will never need fixups
This commit does two things. Firstly, it adds a collection of flags which can
be passed along to the target to encode information about the MBB that an
instruction lives in to the outliner.
Second, it adds some of those flags to the AArch64 outliner in order to add
more stack instructions to the list of legal instructions that are handled
by the outliner. The two flags added check if
- There are calls in the MachineBasicBlock containing the instruction
- The link register is available in the entire block
If the link register is available and there are no calls, then a stack
instruction can always be outlined without fixups, regardless of what it is,
since in this case, the outliner will never modify the stack to create a
call or outlined frame.
The motivation for doing this was checking which instructions are most often
missed by the outliner. Instructions like, say
%sp<def> = ADDXri %sp, 32, 0; flags: FrameDestroy
are very common, but cannot be outlined in the case that the outliner might
modify the stack. This commit allows us to outline instructions like this.
llvm-svn: 322048
2018-01-09 08:26:18 +08:00
|
|
|
|
2018-12-02 05:24:06 +08:00
|
|
|
# CHECK-DAG: bb.2
|
2017-09-28 04:47:39 +08:00
|
|
|
# CHECK: BL @OUTLINED_FUNCTION_[[F0]]
|
2018-07-31 01:45:28 +08:00
|
|
|
# CHECK-NEXT: $lr = ORRXrs $xzr, $x[[REG]], 0
|
2018-12-02 05:23:58 +08:00
|
|
|
# CHECK-NEXT: STRHHroW $w12, $x9, $w30, 1, 1
|
2018-02-01 06:04:26 +08:00
|
|
|
# CHECK-NEXT: $lr = ORRXri $xzr, 1
|
[MachineOutliner] AArch64: Handle instrs that use SP and will never need fixups
This commit does two things. Firstly, it adds a collection of flags which can
be passed along to the target to encode information about the MBB that an
instruction lives in to the outliner.
Second, it adds some of those flags to the AArch64 outliner in order to add
more stack instructions to the list of legal instructions that are handled
by the outliner. The two flags added check if
- There are calls in the MachineBasicBlock containing the instruction
- The link register is available in the entire block
If the link register is available and there are no calls, then a stack
instruction can always be outlined without fixups, regardless of what it is,
since in this case, the outliner will never modify the stack to create a
call or outlined frame.
The motivation for doing this was checking which instructions are most often
missed by the outliner. Instructions like, say
%sp<def> = ADDXri %sp, 32, 0; flags: FrameDestroy
are very common, but cannot be outlined in the case that the outliner might
modify the stack. This commit allows us to outline instructions like this.
llvm-svn: 322048
2018-01-09 08:26:18 +08:00
|
|
|
|
2018-12-02 05:24:06 +08:00
|
|
|
# CHECK-DAG: bb.3
|
2017-09-28 04:47:39 +08:00
|
|
|
# CHECK: BL @OUTLINED_FUNCTION_[[F0]]
|
2018-07-31 01:45:28 +08:00
|
|
|
# CHECK-NEXT: $lr = ORRXrs $xzr, $x[[REG]], 0
|
2018-12-02 05:23:58 +08:00
|
|
|
# CHECK-NEXT: STRHHroW $w12, $x9, $w30, 1, 1
|
2018-02-01 06:04:26 +08:00
|
|
|
# CHECK-NEXT: $lr = ORRXri $xzr, 1
|
2017-08-09 05:51:26 +08:00
|
|
|
name: main
|
[MachineOutliner] AArch64: Handle instrs that use SP and will never need fixups
This commit does two things. Firstly, it adds a collection of flags which can
be passed along to the target to encode information about the MBB that an
instruction lives in to the outliner.
Second, it adds some of those flags to the AArch64 outliner in order to add
more stack instructions to the list of legal instructions that are handled
by the outliner. The two flags added check if
- There are calls in the MachineBasicBlock containing the instruction
- The link register is available in the entire block
If the link register is available and there are no calls, then a stack
instruction can always be outlined without fixups, regardless of what it is,
since in this case, the outliner will never modify the stack to create a
call or outlined frame.
The motivation for doing this was checking which instructions are most often
missed by the outliner. Instructions like, say
%sp<def> = ADDXri %sp, 32, 0; flags: FrameDestroy
are very common, but cannot be outlined in the case that the outliner might
modify the stack. This commit allows us to outline instructions like this.
llvm-svn: 322048
2018-01-09 08:26:18 +08:00
|
|
|
tracksRegLiveness: true
|
2017-08-09 05:51:26 +08:00
|
|
|
body: |
|
2017-09-28 04:47:39 +08:00
|
|
|
bb.0:
|
2018-12-02 05:24:06 +08:00
|
|
|
liveins: $lr
|
2018-02-01 06:04:26 +08:00
|
|
|
$sp = frame-setup SUBXri $sp, 16, 0
|
|
|
|
renamable $x9 = ADRP target-flags(aarch64-page) @bar
|
|
|
|
$x9 = ORRXri $xzr, 1
|
2018-12-02 05:23:58 +08:00
|
|
|
$w12 = ORRWri $wzr, 1
|
2018-02-01 06:04:26 +08:00
|
|
|
$w30 = ORRWri $wzr, 1
|
|
|
|
$lr = ORRXri $xzr, 1
|
2018-12-02 05:24:06 +08:00
|
|
|
bb.1:
|
|
|
|
liveins: $lr
|
2018-02-01 06:04:26 +08:00
|
|
|
$x20, $x19 = LDPXi $sp, 10
|
2018-12-02 05:23:58 +08:00
|
|
|
$w12 = ORRWri $wzr, 1
|
|
|
|
$w12 = ORRWri $wzr, 1
|
|
|
|
$w12 = ORRWri $wzr, 1
|
|
|
|
$w12 = ORRWri $wzr, 1
|
|
|
|
$w12 = ORRWri $wzr, 1
|
|
|
|
$w12 = ORRWri $wzr, 1
|
2018-02-01 06:04:26 +08:00
|
|
|
renamable $x9 = ADRP target-flags(aarch64-page) @x
|
2018-12-02 05:23:58 +08:00
|
|
|
$x12 = ADDXri $sp, 48, 0;
|
|
|
|
STRHHroW $w12, $x9, $w30, 1, 1
|
2018-02-01 06:04:26 +08:00
|
|
|
$lr = ORRXri $xzr, 1
|
2018-12-02 05:24:06 +08:00
|
|
|
bb.2:
|
|
|
|
liveins: $lr
|
2018-02-01 06:04:26 +08:00
|
|
|
$x20, $x19 = LDPXi $sp, 10
|
2018-12-02 05:23:58 +08:00
|
|
|
$w12 = ORRWri $wzr, 1
|
|
|
|
$w12 = ORRWri $wzr, 1
|
|
|
|
$w12 = ORRWri $wzr, 1
|
|
|
|
$w12 = ORRWri $wzr, 1
|
|
|
|
$w12 = ORRWri $wzr, 1
|
|
|
|
$w12 = ORRWri $wzr, 1
|
2018-02-01 06:04:26 +08:00
|
|
|
renamable $x9 = ADRP target-flags(aarch64-page) @x
|
2018-12-02 05:23:58 +08:00
|
|
|
$x12 = ADDXri $sp, 48, 0;
|
|
|
|
STRHHroW $w12, $x9, $w30, 1, 1
|
|
|
|
$lr = ORRXri $xzr, 1
|
2018-12-02 05:24:06 +08:00
|
|
|
bb.3:
|
|
|
|
liveins: $lr
|
2018-02-01 06:04:26 +08:00
|
|
|
$x20, $x19 = LDPXi $sp, 10
|
2018-12-02 05:23:58 +08:00
|
|
|
$w12 = ORRWri $wzr, 1
|
|
|
|
$w12 = ORRWri $wzr, 1
|
|
|
|
$w12 = ORRWri $wzr, 1
|
|
|
|
$w12 = ORRWri $wzr, 1
|
|
|
|
$w12 = ORRWri $wzr, 1
|
|
|
|
$w12 = ORRWri $wzr, 1
|
2018-02-01 06:04:26 +08:00
|
|
|
renamable $x9 = ADRP target-flags(aarch64-page) @x
|
2018-12-02 05:23:58 +08:00
|
|
|
$x12 = ADDXri $sp, 48, 0;
|
|
|
|
STRHHroW $w12, $x9, $w30, 1, 1
|
2018-02-01 06:04:26 +08:00
|
|
|
$lr = ORRXri $xzr, 1
|
|
|
|
$sp = ADDXri $sp, 16, 0
|
2018-12-02 05:24:06 +08:00
|
|
|
bb.4:
|
|
|
|
liveins: $lr
|
2018-02-01 06:04:26 +08:00
|
|
|
RET undef $lr
|
2017-09-28 04:47:39 +08:00
|
|
|
|
|
|
|
...
|
|
|
|
---
|
|
|
|
# This test ensures that we can avoid saving LR when it's available.
|
2018-03-17 06:53:34 +08:00
|
|
|
# It also makes sure that KILL instructions don't impact outlining.
|
2017-09-28 04:47:39 +08:00
|
|
|
# CHECK-LABEL: bb.1:
|
2018-02-01 06:04:26 +08:00
|
|
|
# CHECK-NOT: BL @baz, implicit-def dead $lr, implicit $sp
|
|
|
|
# CHECK: BL @OUTLINED_FUNCTION_[[F1:[0-9]+]], implicit-def $lr, implicit $sp
|
2018-12-02 05:23:58 +08:00
|
|
|
# CHECK-NEXT: $w11 = ORRWri $wzr, 2
|
2018-02-01 06:04:26 +08:00
|
|
|
# CHECK-NEXT: BL @OUTLINED_FUNCTION_[[F1]], implicit-def $lr, implicit $sp
|
|
|
|
# CHECK-NEXT: $w8 = ORRWri $wzr, 0
|
2018-12-02 05:23:58 +08:00
|
|
|
# CHECK-NOT: $w11 = KILL renamable $w11, implicit killed $w11
|
2017-09-28 04:47:39 +08:00
|
|
|
name: bar
|
|
|
|
tracksRegLiveness: true
|
|
|
|
body: |
|
|
|
|
bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $w0, $lr, $w8
|
|
|
|
$sp = frame-setup SUBXri $sp, 32, 0
|
|
|
|
$fp = frame-setup ADDXri $sp, 16, 0
|
2017-09-28 04:47:39 +08:00
|
|
|
|
|
|
|
bb.1:
|
2018-02-01 06:04:26 +08:00
|
|
|
BL @baz, implicit-def dead $lr, implicit $sp
|
2018-12-02 05:23:58 +08:00
|
|
|
$w11 = ORRWri $wzr, 1
|
|
|
|
$w11 = ORRWri $wzr, 1
|
|
|
|
$w11 = KILL renamable $w11, implicit killed $w11
|
|
|
|
$w11 = ORRWri $wzr, 1
|
|
|
|
$w11 = ORRWri $wzr, 1
|
2018-02-01 06:04:26 +08:00
|
|
|
BL @baz, implicit-def dead $lr, implicit $sp
|
2018-12-02 05:23:58 +08:00
|
|
|
$w11 = ORRWri $wzr, 1
|
|
|
|
$w11 = ORRWri $wzr, 1
|
|
|
|
$w11 = ORRWri $wzr, 2
|
2018-02-01 06:04:26 +08:00
|
|
|
BL @baz, implicit-def dead $lr, implicit $sp
|
2018-12-02 05:23:58 +08:00
|
|
|
$w11 = ORRWri $wzr, 1
|
|
|
|
$w11 = ORRWri $wzr, 1
|
|
|
|
$w11 = ORRWri $wzr, 1
|
|
|
|
$w11 = ORRWri $wzr, 1
|
2018-02-01 06:04:26 +08:00
|
|
|
BL @baz, implicit-def dead $lr, implicit $sp
|
2018-12-02 05:23:58 +08:00
|
|
|
$w11 = ORRWri $wzr, 1
|
|
|
|
$w11 = ORRWri $wzr, 1
|
2018-02-01 06:04:26 +08:00
|
|
|
$w8 = ORRWri $wzr, 0
|
2018-12-02 05:23:58 +08:00
|
|
|
|
2017-09-28 04:47:39 +08:00
|
|
|
bb.2:
|
2018-02-01 06:04:26 +08:00
|
|
|
$w15 = ORRWri $wzr, 1
|
|
|
|
$w15 = ORRWri $wzr, 1
|
|
|
|
$w15 = ORRWri $wzr, 1
|
|
|
|
$w15 = ORRWri $wzr, 1
|
|
|
|
$x15 = ADDXri $sp, 48, 0;
|
|
|
|
$w9 = ORRWri $wzr, 0
|
|
|
|
$w15 = ORRWri $wzr, 1
|
|
|
|
$w15 = ORRWri $wzr, 1
|
|
|
|
$w15 = ORRWri $wzr, 1
|
|
|
|
$w15 = ORRWri $wzr, 1
|
|
|
|
$x15 = ADDXri $sp, 48, 0;
|
|
|
|
$w8 = ORRWri $wzr, 0
|
2018-12-02 05:23:58 +08:00
|
|
|
|
[MachineOutliner] AArch64: Handle instrs that use SP and will never need fixups
This commit does two things. Firstly, it adds a collection of flags which can
be passed along to the target to encode information about the MBB that an
instruction lives in to the outliner.
Second, it adds some of those flags to the AArch64 outliner in order to add
more stack instructions to the list of legal instructions that are handled
by the outliner. The two flags added check if
- There are calls in the MachineBasicBlock containing the instruction
- The link register is available in the entire block
If the link register is available and there are no calls, then a stack
instruction can always be outlined without fixups, regardless of what it is,
since in this case, the outliner will never modify the stack to create a
call or outlined frame.
The motivation for doing this was checking which instructions are most often
missed by the outliner. Instructions like, say
%sp<def> = ADDXri %sp, 32, 0; flags: FrameDestroy
are very common, but cannot be outlined in the case that the outliner might
modify the stack. This commit allows us to outline instructions like this.
llvm-svn: 322048
2018-01-09 08:26:18 +08:00
|
|
|
bb.3:
|
2018-02-01 06:04:26 +08:00
|
|
|
$fp, $lr = LDPXi $sp, 2
|
|
|
|
$sp = ADDXri $sp, 32, 0
|
|
|
|
RET undef $lr
|
2017-09-28 04:47:39 +08:00
|
|
|
|
|
|
|
...
|
2017-12-19 03:33:21 +08:00
|
|
|
---
|
|
|
|
name: baz
|
|
|
|
tracksRegLiveness: true
|
|
|
|
body: |
|
|
|
|
bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $w0, $lr, $w8
|
|
|
|
RET undef $lr
|
2017-09-28 04:47:39 +08:00
|
|
|
|
|
|
|
# CHECK-LABEL: name: OUTLINED_FUNCTION_{{[0-9]}}
|
|
|
|
# CHECK=LABEL: name: OUTLINED_FUNCTION_{{[1-9]}}
|