The instruction-precise, or asynchronous, unwind tables usually take up much more space than the synchronous ones. If a user is concerned about the load size of the program and does not need the features provided with the asynchronous tables, the compiler should be able to generate the more compact variant. This patch changes the generation of CFI instructions for these cases so that they all come in one chunk in the prolog; it emits only one `.cfi_def_cfa*` instruction followed by `.cfi_offset` ones after all stack adjustments and register spills, and avoids generating CFI instructions in the epilog(s) as well as any other exceeding CFI instructions like `.cfi_remember_state` and `.cfi_restore_state`. Effectively, it reverses the effects of D111411 and D114545 on functions with the `uwtable(sync)` attribute. As a side effect, it also restores the behavior on functions that have neither `uwtable` nor `nounwind` attributes. Differential Revision: https://reviews.llvm.org/D153098
102 lines
3.5 KiB
LLVM
102 lines
3.5 KiB
LLVM
; RUN: llc -verify-machineinstrs -enable-machine-outliner -mtriple=aarch64 -frame-pointer=non-leaf < %s | FileCheck %s --check-prefix=NOOMIT
|
|
; RUN: llc -verify-machineinstrs -enable-machine-outliner -mtriple=aarch64 -frame-pointer=none < %s | FileCheck %s --check-prefix=OMITFP
|
|
|
|
define void @_Z1giii(i32 %x, i32 %y, i32 %z) minsize {
|
|
; NOOMIT-LABEL: _Z1giii:
|
|
; NOOMIT: // %bb.0: // %entry
|
|
; NOOMIT-NEXT: b _Z1hiii
|
|
;
|
|
; OMITFP-LABEL: _Z1giii:
|
|
; OMITFP: // %bb.0: // %entry
|
|
; OMITFP-NEXT: b _Z1hiii
|
|
entry:
|
|
tail call void @_Z1hiii(i32 %x, i32 %y, i32 %z)
|
|
ret void
|
|
}
|
|
|
|
declare void @_Z1hiii(i32, i32, i32) minsize
|
|
|
|
define void @_Z2f1v() minsize {
|
|
; NOOMIT-LABEL: _Z2f1v:
|
|
; NOOMIT: // %bb.0: // %entry
|
|
; NOOMIT-NEXT: stp x29, x30, [sp, #-16]! // 16-byte Folded Spill
|
|
; NOOMIT-NEXT: mov x29, sp
|
|
; NOOMIT-NEXT: .cfi_def_cfa w29, 16
|
|
; NOOMIT-NEXT: .cfi_offset w30, -8
|
|
; NOOMIT-NEXT: .cfi_offset w29, -16
|
|
; NOOMIT-NEXT: bl OUTLINED_FUNCTION_0
|
|
; NOOMIT-NEXT: ldp x29, x30, [sp], #16 // 16-byte Folded Reload
|
|
; NOOMIT-NEXT: b _Z1giii
|
|
;
|
|
; OMITFP-LABEL: _Z2f1v:
|
|
; OMITFP: // %bb.0: // %entry
|
|
; OMITFP-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
|
|
; OMITFP-NEXT: .cfi_def_cfa_offset 16
|
|
; OMITFP-NEXT: .cfi_offset w30, -16
|
|
; OMITFP-NEXT: bl OUTLINED_FUNCTION_0
|
|
; OMITFP-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
|
|
; OMITFP-NEXT: b _Z1giii
|
|
entry:
|
|
tail call void @_Z1giii(i32 1, i32 2, i32 3)
|
|
tail call void @_Z1giii(i32 1, i32 2, i32 3)
|
|
ret void
|
|
}
|
|
|
|
define void @_Z2f2v() minsize {
|
|
; NOOMIT-LABEL: _Z2f2v:
|
|
; NOOMIT: // %bb.0: // %entry
|
|
; NOOMIT-NEXT: stp x29, x30, [sp, #-16]! // 16-byte Folded Spill
|
|
; NOOMIT-NEXT: mov x29, sp
|
|
; NOOMIT-NEXT: .cfi_def_cfa w29, 16
|
|
; NOOMIT-NEXT: .cfi_offset w30, -8
|
|
; NOOMIT-NEXT: .cfi_offset w29, -16
|
|
; NOOMIT-NEXT: bl OUTLINED_FUNCTION_0
|
|
; NOOMIT-NEXT: ldp x29, x30, [sp], #16 // 16-byte Folded Reload
|
|
; NOOMIT-NEXT: b _Z1giii
|
|
;
|
|
; OMITFP-LABEL: _Z2f2v:
|
|
; OMITFP: // %bb.0: // %entry
|
|
; OMITFP-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
|
|
; OMITFP-NEXT: .cfi_def_cfa_offset 16
|
|
; OMITFP-NEXT: .cfi_offset w30, -16
|
|
; OMITFP-NEXT: bl OUTLINED_FUNCTION_0
|
|
; OMITFP-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
|
|
; OMITFP-NEXT: b _Z1giii
|
|
entry:
|
|
tail call void @_Z1giii(i32 1, i32 2, i32 3)
|
|
tail call void @_Z1giii(i32 1, i32 2, i32 3)
|
|
ret void
|
|
}
|
|
|
|
; OMITFP-LABEL: OUTLINED_FUNCTION_0:
|
|
; OMITFP: .cfi_startproc
|
|
; OMITFP-NEXT: // %bb.0:
|
|
; OMITFP-NEXT: .cfi_def_cfa_offset 16
|
|
; OMITFP-NEXT: .cfi_offset w30, -16
|
|
; OMITFP-NEXT: str x30, [sp, #-16]!
|
|
; OMITFP-NEXT: mov w0, #1
|
|
; OMITFP-NEXT: mov w1, #2
|
|
; OMITFP-NEXT: mov w2, #3
|
|
; OMITFP-NEXT: bl _Z1giii
|
|
; OMITFP-NEXT: mov w0, #1
|
|
; OMITFP-NEXT: mov w1, #2
|
|
; OMITFP-NEXT: mov w2, #3
|
|
; OMITFP-NEXT: ldr x30, [sp], #16
|
|
; OMITFP-NEXT: ret
|
|
|
|
; NOOMIT-LABEL: OUTLINED_FUNCTION_0:
|
|
; NOOMIT: .cfi_startproc
|
|
; NOOMIT-NEXT: // %bb.0:
|
|
; NOOMIT-NEXT: .cfi_def_cfa_offset 16
|
|
; NOOMIT-NEXT: .cfi_offset w30, -16
|
|
; NOOMIT-NEXT: str x30, [sp, #-16]!
|
|
; NOOMIT-NEXT: mov w0, #1
|
|
; NOOMIT-NEXT: mov w1, #2
|
|
; NOOMIT-NEXT: mov w2, #3
|
|
; NOOMIT-NEXT: bl _Z1giii
|
|
; NOOMIT-NEXT: mov w0, #1
|
|
; NOOMIT-NEXT: mov w1, #2
|
|
; NOOMIT-NEXT: mov w2, #3
|
|
; NOOMIT-NEXT: ldr x30, [sp], #16
|
|
; NOOMIT-NEXT: ret
|