Sander de Smalen de81b852fd
[AArch64] Allow variadic calls with SVE argument if it is named. (#136833)
The following case used to work:

  void foo(svint32_t a, ...);
  void bar(svint32_t a) { foo(a); }

but 6c9086d13fa7e1069e75ed2d139aae30ee3863c8 introduced a regression
that wasn't caught by the existing test `sve-varargs.ll` because the
call in the test wasn't a tail call and therefore skipped the code-path
with the `report_fatal_error`.
2025-04-24 07:57:09 +01:00

34 lines
1.2 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=aarch64--linux-gnu -mattr=+sve < %s | FileCheck %s
declare i32 @sve_printf(ptr, <vscale x 4 x i32>, ...)
@.str_1 = internal constant [6 x i8] c"boo!\0A\00"
define void @foo_nontail(<vscale x 4 x i32> %x) uwtable {
; CHECK-LABEL: foo_nontail:
; CHECK: // %bb.0:
; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
; CHECK-NEXT: .cfi_def_cfa_offset 16
; CHECK-NEXT: .cfi_offset w30, -16
; CHECK-NEXT: adrp x0, .str_1
; CHECK-NEXT: add x0, x0, :lo12:.str_1
; CHECK-NEXT: bl sve_printf
; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
; CHECK-NEXT: .cfi_def_cfa_offset 0
; CHECK-NEXT: .cfi_restore w30
; CHECK-NEXT: ret
call i32 (ptr, <vscale x 4 x i32>, ...) @sve_printf(ptr @.str_1, <vscale x 4 x i32> %x)
ret void
}
define void @foo_tail(<vscale x 4 x i32> %x) uwtable {
; CHECK-LABEL: foo_tail:
; CHECK: // %bb.0:
; CHECK-NEXT: adrp x0, .str_1
; CHECK-NEXT: add x0, x0, :lo12:.str_1
; CHECK-NEXT: b sve_printf
tail call i32 (ptr, <vscale x 4 x i32>, ...) @sve_printf(ptr @.str_1, <vscale x 4 x i32> %x)
ret void
}