fail(DL, DAG, "WebAssembly hasn't implemented cons regs arguments");
if (Out.Flags.isInConsecutiveRegsLast())
fail(DL, DAG, "WebAssembly hasn't implemented cons regs last arguments");
- if (Out.Flags.isByVal()) {
+ if (Out.Flags.isByVal() && Out.Flags.getByValSize() != 0) {
auto *MFI = MF.getFrameInfo();
- assert(Out.Flags.getByValSize() && "Zero-size byval?");
int FI = MFI->CreateStackObject(Out.Flags.getByValSize(),
Out.Flags.getByValAlign(),
/*isSS=*/false);
%OddStruct = type { i32, i8, i32 }
%AlignedStruct = type { double, double }
%BigStruct = type { double, double, double, double, double, double, double, double, double, double, double, i8, i8, i8 }
+%EmptyStruct = type { }
%BigArray = type { [33 x i8] }
declare void @ext_func(%SmallStruct*)
+declare void @ext_func_empty(%EmptyStruct* byval)
declare void @ext_byval_func(%SmallStruct* byval)
declare void @ext_byval_func_align8(%SmallStruct* byval align 8)
declare void @ext_byval_func_alignedstruct(%AlignedStruct* byval)
declare void @ext_byval_func_bigarray(%BigArray* byval)
+declare void @ext_byval_func_empty(%EmptyStruct* byval)
; CHECK-LABEL: byval_arg
define void @byval_arg(%SmallStruct* %ptr) {
call void @ext_func(%SmallStruct* %ptr)
ret void
}
+
+; CHECK-LABEL: byval_empty_caller
+define void @byval_empty_caller(%EmptyStruct* %ptr) {
+ ; CHECK: .param i32
+ ; CHECK: call ext_byval_func_empty@FUNCTION, $0
+ call void @ext_byval_func_empty(%EmptyStruct* byval %ptr)
+ ret void
+}
+
+; CHECK-LABEL: byval_empty_callee
+define void @byval_empty_callee(%EmptyStruct* byval %ptr) {
+ ; CHECK: .param i32
+ ; CHECK: call ext_func_empty@FUNCTION, $0
+ call void @ext_func_empty(%EmptyStruct* %ptr)
+ ret void
+}