[PATCH] D90230: [SVE] Add fatal error for unnamed SVE variadic arguments

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 27 10:51:19 PDT 2020


david-arm updated this revision to Diff 301057.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90230/new/

https://reviews.llvm.org/D90230

Files:
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/test/CodeGen/AArch64/sve-varargs-broken.ll
  llvm/test/CodeGen/AArch64/sve-varargs.ll


Index: llvm/test/CodeGen/AArch64/sve-varargs.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AArch64/sve-varargs.ll
@@ -0,0 +1,26 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mtriple=aarch64--linux-gnu -mattr=+sve < %s 2>%t | FileCheck %s
+; RUN: FileCheck --check-prefix=WARN --allow-empty %s <%t
+
+; If this check fails please read test/CodeGen/AArch64/README for instructions on how to resolve it.
+; WARN-NOT: warning
+
+declare i32 @sve_printf(i8*, <vscale x 4 x i32>, ...)
+
+ at .str_1 = internal constant [6 x i8] c"boo!\0A\00"
+
+define void @foo(<vscale x 4 x i32> %x) {
+; CHECK-LABEL: foo:
+; 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:    ret
+  %f = getelementptr [6 x i8], [6 x i8]* @.str_1, i64 0, i64 0
+  call i32 (i8*, <vscale x 4 x i32>, ...) @sve_printf(i8* %f, <vscale x 4 x i32> %x)
+  ret void
+}
Index: llvm/test/CodeGen/AArch64/sve-varargs-broken.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AArch64/sve-varargs-broken.ll
@@ -0,0 +1,12 @@
+; RUN: not --crash llc -mtriple aarch64-linux-gnu -mattr=+sve <%s 2>&1 | FileCheck %s
+
+declare i32 @sve_printf(i8*, <vscale x 4 x i32>, ...)
+
+ at .str_1 = internal constant [6 x i8] c"boo!\0A\00"
+
+; CHECK: Passing SVE types to variadic functions is currently not supported
+define void @foo(<vscale x 4 x i32> %x) {
+  %f = getelementptr [6 x i8], [6 x i8]* @.str_1, i64 0, i64 0
+  call i32 (i8*, <vscale x 4 x i32>, ...) @sve_printf(i8* %f, <vscale x 4 x i32> %x, <vscale x 4 x i32> %x)
+  ret void
+}
Index: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -4798,6 +4798,10 @@
 
     for (unsigned i = 0; i != NumArgs; ++i) {
       MVT ArgVT = Outs[i].VT;
+      if (!Outs[i].IsFixed && ArgVT.isScalableVector())
+        report_fatal_error("Passing SVE types to variadic functions is "
+                           "currently not supported");
+
       ISD::ArgFlagsTy ArgFlags = Outs[i].Flags;
       CCAssignFn *AssignFn = CCAssignFnForCall(CallConv,
                                                /*IsVarArg=*/ !Outs[i].IsFixed);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90230.301057.patch
Type: text/x-patch
Size: 2655 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201027/1d722f12/attachment.bin>


More information about the llvm-commits mailing list