mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
8d0558ea7e
Summary: Reland after fixing an ASan failure by stopping outlining early if the constraints for return address signing removed too many outlining candidates. During AArch64 frame lowering instructions to enable return address signing are inserted into functions if needed. Functions generated during machine outlining don't run through target frame lowering and hence are missing such instructions. This patch introduces the following changes: 1. If not all functions that potentially participate in function outlining agree on their return address signing scope and their return address signing key, outlining is disabled for these functions. 2. If not all functions that potentially participate in function outlining agree on their support for v8.3A features, outlining is disabled for these functions. 3. If an outlining candidate would outline instructions that modify sp in a way that invalidates return address signing, outlining is disabled for that particular candidate. 4. If all candidate functions agree on the signing scope, signing key and their support for v8.3 features, the outlined function behaves as if it had the same scope and key attributes and as if it would provide the same v8.3A support as the original functions. Reviewers: ostannard, paquette Reviewed By: ostannard Subscribers: kristof.beyls, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70635
128 lines
3.9 KiB
YAML
128 lines
3.9 KiB
YAML
# RUN: llc -mtriple=aarch64-arm-none-eabi -run-pass=prologepilog \
|
|
# RUN: -run-pass=machine-outliner -verify-machineinstrs %s -o - | FileCheck %s
|
|
|
|
# Check that we save LR to a callee-saved register when possible.
|
|
# foo() should use a callee-saved register. However, bar() should not.
|
|
--- |
|
|
|
|
define void @foo() #0 {
|
|
ret void
|
|
}
|
|
|
|
define void @bar() #0 {
|
|
ret void
|
|
}
|
|
|
|
attributes #0 = { nounwind "sign-return-address"="non-leaf" "sign-return-address-key"="b_key" minsize noinline noredzone "no-frame-pointer-elim"="true" }
|
|
...
|
|
---
|
|
# CHECK-LABEL: name: foo
|
|
# CHECK: bb.0:
|
|
# CHECK: frame-setup EMITBKEY
|
|
# CHECK-NEXT: frame-setup PACIBSP
|
|
# CHECK-NEXT: frame-setup CFI_INSTRUCTION negate_ra_sign_state
|
|
# CHECK: bb.1:
|
|
# CHECK: BL @[[OUTLINED_FUNCTION:OUTLINED_FUNCTION_[0-9]+]]
|
|
# CHECK: bb.2:
|
|
# CHECK: BL @[[OUTLINED_FUNCTION]]
|
|
# CHECK: bb.3:
|
|
# CHECK: BL @[[OUTLINED_FUNCTION]]
|
|
# CHECK: bb.4:
|
|
# CHECK: BL @[[OUTLINED_FUNCTION]]
|
|
# CHECK: bb.5:
|
|
# CHECK: frame-destroy AUTIBSP
|
|
# CHECK-NEXT: RET
|
|
name: foo
|
|
tracksRegLiveness: true
|
|
fixedStack:
|
|
body: |
|
|
bb.0:
|
|
$x25 = ORRXri $xzr, 1
|
|
$lr = ORRXri $xzr, 1
|
|
bb.1:
|
|
liveins: $lr, $w9
|
|
$w9 = ORRWri $wzr, 1
|
|
$w9 = ORRWri $wzr, 1
|
|
$w9 = ORRWri $wzr, 1
|
|
$w9 = ORRWri $wzr, 1
|
|
$w9 = ORRWri $wzr, 1
|
|
$w9 = ORRWri $wzr, 2
|
|
bb.2:
|
|
liveins: $lr, $w9
|
|
$w9 = ORRWri $wzr, 1
|
|
$w9 = ORRWri $wzr, 1
|
|
$w9 = ORRWri $wzr, 1
|
|
$w9 = ORRWri $wzr, 1
|
|
$w9 = ORRWri $wzr, 1
|
|
$w9 = ORRWri $wzr, 2
|
|
bb.3:
|
|
liveins: $lr, $w9
|
|
$w9 = ORRWri $wzr, 1
|
|
$w9 = ORRWri $wzr, 1
|
|
$w9 = ORRWri $wzr, 1
|
|
$w9 = ORRWri $wzr, 1
|
|
$w9 = ORRWri $wzr, 1
|
|
$w9 = ORRWri $wzr, 2
|
|
bb.4:
|
|
liveins: $lr, $w9
|
|
$w9 = ORRWri $wzr, 1
|
|
$w9 = ORRWri $wzr, 1
|
|
$w9 = ORRWri $wzr, 1
|
|
$w9 = ORRWri $wzr, 1
|
|
$w9 = ORRWri $wzr, 1
|
|
$w9 = ORRWri $wzr, 2
|
|
bb.5:
|
|
liveins: $w9
|
|
RET undef $lr
|
|
|
|
...
|
|
---
|
|
# CHECK: name: bar
|
|
# CHECK: bb.0:
|
|
# CHECK-NOT: OUTLINED_FUNCTION_
|
|
# CHECK: bb.1:
|
|
# CHECK-NOT: OUTLINED_FUNCTION_
|
|
# CHECK: bb.2:
|
|
# CHECK-NOT: OUTLINED_FUNCTION_
|
|
# CHECK: bb.3:
|
|
# CHECK-NOT: OUTLINED_FUNCTION_
|
|
# CHECK: RET
|
|
name: bar
|
|
tracksRegLiveness: true
|
|
body: |
|
|
bb.0:
|
|
liveins: $lr, $x0, $x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x19, $x20, $x21, $x22, $x23, $x20, $x21, $x22, $x23, $x24, $x25, $x26, $x27, $x28
|
|
$w10 = ORRWri $wzr, 1
|
|
$w10 = ORRWri $wzr, 1
|
|
$w10 = ORRWri $wzr, 1
|
|
$w10 = ORRWri $wzr, 1
|
|
$w10 = ORRWri $wzr, 1
|
|
$w12 = ORRWri $wzr, 2
|
|
bb.1:
|
|
liveins: $lr, $x0, $x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x19, $x20, $x21, $x22, $x23, $x20, $x21, $x22, $x23, $x24, $x25, $x26, $x27, $x28
|
|
$w10 = ORRWri $wzr, 1
|
|
$w10 = ORRWri $wzr, 1
|
|
$w10 = ORRWri $wzr, 1
|
|
$w10 = ORRWri $wzr, 1
|
|
$w10 = ORRWri $wzr, 1
|
|
$w12 = ORRWri $wzr, 2
|
|
bb.2:
|
|
liveins: $lr, $x0, $x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x19, $x20, $x21, $x22, $x23, $x20, $x21, $x22, $x23, $x24, $x25, $x26, $x27, $x28
|
|
$w10 = ORRWri $wzr, 1
|
|
$w10 = ORRWri $wzr, 1
|
|
$w10 = ORRWri $wzr, 1
|
|
$w10 = ORRWri $wzr, 1
|
|
$w10 = ORRWri $wzr, 1
|
|
$w12 = ORRWri $wzr, 2
|
|
bb.3:
|
|
liveins: $lr, $x0, $x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x19, $x20, $x21, $x22, $x23, $x20, $x21, $x22, $x23, $x24, $x25, $x26, $x27, $x28
|
|
RET undef $lr
|
|
|
|
# CHECK: name: [[OUTLINED_FUNCTION]]
|
|
# CHECK: body:
|
|
# CHECK-NEXT: bb.0:
|
|
# CHECK-NOT: frame-setup EMITBKEY
|
|
# CHECK-NOT: frame-setup PACI{{[A,B]]}}SP
|
|
# CHECK-NOT: frame-setup CFI_INSTRUCTION negate_ra_sign_state
|
|
# CHECK-NOT: frame-destroy AUTI{{[A,B]]}}SP
|