2017-08-09 05:51:26 +08:00
|
|
|
# RUN: llc -mtriple=aarch64--- -run-pass=machine-outliner %s -o - | FileCheck %s
|
|
|
|
--- |
|
2017-09-28 04:47:39 +08:00
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2017-09-28 04:47:39 +08:00
|
|
|
define void @bar(i32 %a) #0 {
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
attributes #0 = { noinline noredzone "no-frame-pointer-elim"="true" }
|
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
|
2017-08-09 05:51:26 +08:00
|
|
|
#
|
|
|
|
# CHECK-LABEL: name: main
|
2017-09-28 04:47:39 +08:00
|
|
|
# CHECK: BL @OUTLINED_FUNCTION_[[F0:[0-9]+]]
|
|
|
|
# CHECK-NEXT: early-clobber %sp, %lr = LDRXpost %sp, 16
|
|
|
|
# CHECK-NEXT: STRHHroW %w16, %x9, %w30, 1, 1
|
|
|
|
# CHECK-NEXT: %lr = ORRXri %xzr, 1
|
|
|
|
# CHECK: BL @OUTLINED_FUNCTION_[[F0]]
|
|
|
|
# CHECK-NEXT: early-clobber %sp, %lr = LDRXpost %sp, 16
|
|
|
|
# CHECK-NEXT: STRHHroW %w16, %x9, %w30, 1, 1
|
|
|
|
# CHECK-NEXT: %lr = ORRXri %xzr, 1
|
|
|
|
# CHECK: BL @OUTLINED_FUNCTION_[[F0]]
|
|
|
|
# CHECK-NEXT: early-clobber %sp, %lr = LDRXpost %sp, 16
|
|
|
|
# CHECK-NEXT: STRHHroW %w16, %x9, %w30, 1, 1
|
|
|
|
# CHECK-NEXT: %lr = ORRXri %xzr, 1
|
2017-08-09 05:51:26 +08:00
|
|
|
name: main
|
|
|
|
body: |
|
2017-09-28 04:47:39 +08:00
|
|
|
bb.0:
|
2017-08-09 05:51:26 +08:00
|
|
|
%sp = frame-setup SUBXri %sp, 16, 0
|
|
|
|
%x9 = ORRXri %xzr, 1
|
|
|
|
%w16 = ORRWri %wzr, 1
|
|
|
|
%w30 = ORRWri %wzr, 1
|
|
|
|
%lr = ORRXri %xzr, 1
|
|
|
|
|
2017-12-08 05:51:43 +08:00
|
|
|
%x20, %x19 = LDPXi %sp, 10
|
2017-08-09 05:51:26 +08:00
|
|
|
%w16 = ORRWri %wzr, 1
|
|
|
|
%w16 = ORRWri %wzr, 1
|
|
|
|
%w16 = ORRWri %wzr, 1
|
|
|
|
%w16 = ORRWri %wzr, 1
|
|
|
|
%w16 = ORRWri %wzr, 1
|
|
|
|
%w16 = ORRWri %wzr, 1
|
|
|
|
STRHHroW %w16, %x9, %w30, 1, 1
|
|
|
|
%lr = ORRXri %xzr, 1
|
|
|
|
|
|
|
|
%w3 = ORRWri %wzr, 1993
|
|
|
|
|
2017-12-08 05:51:43 +08:00
|
|
|
%x20, %x19 = LDPXi %sp, 10
|
2017-08-09 05:51:26 +08:00
|
|
|
%w16 = ORRWri %wzr, 1
|
|
|
|
%w16 = ORRWri %wzr, 1
|
|
|
|
%w16 = ORRWri %wzr, 1
|
|
|
|
%w16 = ORRWri %wzr, 1
|
|
|
|
%w16 = ORRWri %wzr, 1
|
|
|
|
%w16 = ORRWri %wzr, 1
|
|
|
|
STRHHroW %w16, %x9, %w30, 1, 1
|
|
|
|
%lr = ORRXri %xzr, 1
|
|
|
|
|
|
|
|
%w4 = ORRWri %wzr, 1994
|
|
|
|
|
2017-12-08 05:51:43 +08:00
|
|
|
%x20, %x19 = LDPXi %sp, 10
|
2017-08-09 05:51:26 +08:00
|
|
|
%w16 = ORRWri %wzr, 1
|
|
|
|
%w16 = ORRWri %wzr, 1
|
|
|
|
%w16 = ORRWri %wzr, 1
|
|
|
|
%w16 = ORRWri %wzr, 1
|
|
|
|
%w16 = ORRWri %wzr, 1
|
|
|
|
%w16 = ORRWri %wzr, 1
|
|
|
|
STRHHroW %w16, %x9, %w30, 1, 1
|
|
|
|
%lr = ORRXri %xzr, 1
|
|
|
|
|
|
|
|
%sp = ADDXri %sp, 16, 0
|
|
|
|
RET undef %lr
|
2017-09-28 04:47:39 +08:00
|
|
|
|
|
|
|
...
|
|
|
|
---
|
|
|
|
# This test ensures that we can avoid saving LR when it's available.
|
|
|
|
# CHECK-LABEL: bb.1:
|
2017-12-19 03:33:21 +08:00
|
|
|
# CHECK-NOT: BL @baz, implicit-def dead %lr, implicit %sp
|
2017-09-28 04:47:39 +08:00
|
|
|
# CHECK: BL @OUTLINED_FUNCTION_[[F1:[0-9]+]], implicit-def %lr, implicit %sp
|
|
|
|
# CHECK-NEXT: %w17 = ORRWri %wzr, 2
|
|
|
|
# CHECK-NEXT: BL @OUTLINED_FUNCTION_[[F1]], implicit-def %lr, implicit %sp
|
|
|
|
# CHECK-NEXT: %w8 = ORRWri %wzr, 0
|
|
|
|
name: bar
|
|
|
|
tracksRegLiveness: true
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: %w0, %lr, %w8
|
|
|
|
%sp = frame-setup SUBXri %sp, 32, 0
|
|
|
|
%fp = frame-setup ADDXri %sp, 16, 0
|
|
|
|
|
|
|
|
bb.1:
|
2017-12-19 03:33:21 +08:00
|
|
|
BL @baz, implicit-def dead %lr, implicit %sp
|
2017-09-28 04:47:39 +08:00
|
|
|
%w17 = ORRWri %wzr, 1
|
|
|
|
%w17 = ORRWri %wzr, 1
|
|
|
|
%w17 = ORRWri %wzr, 1
|
|
|
|
%w17 = ORRWri %wzr, 1
|
2017-12-19 03:33:21 +08:00
|
|
|
BL @baz, implicit-def dead %lr, implicit %sp
|
2017-09-28 04:47:39 +08:00
|
|
|
%w17 = ORRWri %wzr, 2
|
2017-12-19 03:33:21 +08:00
|
|
|
BL @baz, implicit-def dead %lr, implicit %sp
|
2017-09-28 04:47:39 +08:00
|
|
|
%w17 = ORRWri %wzr, 1
|
|
|
|
%w17 = ORRWri %wzr, 1
|
|
|
|
%w17 = ORRWri %wzr, 1
|
|
|
|
%w17 = ORRWri %wzr, 1
|
2017-12-19 03:33:21 +08:00
|
|
|
BL @baz, implicit-def dead %lr, implicit %sp
|
2017-09-28 04:47:39 +08:00
|
|
|
%w8 = ORRWri %wzr, 0
|
|
|
|
|
|
|
|
bb.2:
|
|
|
|
%fp, %lr = LDPXi %sp, 2
|
|
|
|
%sp = ADDXri %sp, 32, 0
|
|
|
|
RET undef %lr
|
|
|
|
|
|
|
|
...
|
2017-12-19 03:33:21 +08:00
|
|
|
---
|
|
|
|
name: baz
|
|
|
|
tracksRegLiveness: true
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
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]}}
|