summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/WebAssembly
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2018-06-26 03:18:38 +0000
committerDan Gohman <dan433584@gmail.com>2018-06-26 03:18:38 +0000
commit910ba33d0c78bc8866a1939b255f91a5b4cd8eaa (patch)
tree87db357901637f5c257c5f0ae515299f1ae34b06 /llvm/test/CodeGen/WebAssembly
parentc42ed4e3c407dd97b8dcab873950611e89e166fe (diff)
downloadbcm5719-llvm-910ba33d0c78bc8866a1939b255f91a5b4cd8eaa.tar.gz
bcm5719-llvm-910ba33d0c78bc8866a1939b255f91a5b4cd8eaa.zip
[WebAssembly] Fix lowering of varargs functions with non-legal fixed arguments.
CallLoweringInfo's NumFixedArgs field gives the number of fixed arguments before legalization. The ISD::OutputArg "Outs" array holds legalized arguments, so when indexing into it to find the non-fixed arguemn, we need to use the number of arguments after legalization. Fixes PR37934. llvm-svn: 335576
Diffstat (limited to 'llvm/test/CodeGen/WebAssembly')
-rw-r--r--llvm/test/CodeGen/WebAssembly/varargs.ll21
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/WebAssembly/varargs.ll b/llvm/test/CodeGen/WebAssembly/varargs.ll
index acd35c3b4a9..0e26ab4959b 100644
--- a/llvm/test/CodeGen/WebAssembly/varargs.ll
+++ b/llvm/test/CodeGen/WebAssembly/varargs.ll
@@ -143,6 +143,27 @@ bb1:
ret void
}
+; Test a call to a varargs function with a non-legal fixed argument.
+
+declare void @callee_with_nonlegal_fixed(fp128, ...) nounwind
+
+; CHECK-LABEL: call_nonlegal_fixed:
+; CHECK: i64.const $push[[L0:[0-9]+]]=, 0
+; CHECK: i64.const $push[[L1:[0-9]+]]=, 0
+; CHECK: i32.const $push[[L2:[0-9]+]]=, 0
+; CHECK: call callee_with_nonlegal_fixed@FUNCTION, $pop[[L0]], $pop[[L1]], $pop[[L2]]{{$}}
+define void @call_nonlegal_fixed() nounwind {
+ call void (fp128, ...) @callee_with_nonlegal_fixed(fp128 0xL00000000000000000000000000000000)
+ ret void
+}
+
+; Test a definition a varargs function with a non-legal fixed argument.
+
+; CHECK-LABEL: nonlegal_fixed:
+; CHECK-NEXT: .param i64, i64, i32{{$}}
+define void @nonlegal_fixed(fp128 %x, ...) nounwind {
+ ret void
+}
declare void @llvm.va_start(i8*)
declare void @llvm.va_end(i8*)
OpenPOWER on IntegriCloud