Files
clang-p2996/llvm/test/CodeGen/AArch64/aarch64-fastcc-stackup.ll
Igor Kudrin 6e54fccede [AArch64] Emit fewer CFI instructions for synchronous unwind tables
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
2023-07-01 16:31:09 -07:00

50 lines
1.5 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=aarch64-none-linux -O0 -tailcallopt < %s | FileCheck %s
define void @bar() {
; CHECK-LABEL: bar:
; CHECK: // %bb.0:
; CHECK-NEXT: ret
ret void
}
define fastcc i64 @foo(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5, i64 %6, i64 %7, i64 %8) {
; CHECK-LABEL: foo:
; CHECK: // %bb.0:
; CHECK-NEXT: add sp, sp, #16
; CHECK-NEXT: ret
ret i64 %0
}
; https://github.com/llvm/llvm-project/issues/60972
define fastcc i64 @baz() {
; CHECK-LABEL: baz:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: sub sp, sp, #32
; CHECK-NEXT: str x30, [sp, #16] // 8-byte Folded Spill
; CHECK-NEXT: .cfi_def_cfa_offset 32
; CHECK-NEXT: .cfi_offset w30, -16
; CHECK-NEXT: mov x8, sp
; CHECK-NEXT: mov x7, xzr
; CHECK-NEXT: str xzr, [x8]
; CHECK-NEXT: mov x0, x7
; CHECK-NEXT: mov x1, x7
; CHECK-NEXT: mov x2, x7
; CHECK-NEXT: mov x3, x7
; CHECK-NEXT: mov x4, x7
; CHECK-NEXT: mov x5, x7
; CHECK-NEXT: mov x6, x7
; CHECK-NEXT: bl foo
; CHECK-NEXT: sub sp, sp, #16
; CHECK-NEXT: str x0, [sp, #8] // 8-byte Folded Spill
; CHECK-NEXT: bl bar
; CHECK-NEXT: ldr x0, [sp, #8] // 8-byte Folded Reload
; CHECK-NEXT: ldr x30, [sp, #16] // 8-byte Folded Reload
; CHECK-NEXT: add sp, sp, #32
; CHECK-NEXT: ret
entry:
%0 = tail call fastcc i64 @foo(i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0)
call void @bar()
ret i64 %0
}