xref: /llvm-project/llvm/test/CodeGen/WebAssembly/function-bitcasts-varargs.ll (revision 73856247eef35f5336e485dc009842a5b991c421)
1; RUN: llc < %s -asm-verbose=false -wasm-keep-registers | FileCheck %s
2
3; Test that function pointer casts casting away varargs are replaced with
4; wrappers.
5
6target triple = "wasm32-unknown-unknown"
7
8define void @callWithArgs() {
9entry:
10  call void @underspecified(i32 0, i32 1)
11  call void(...) @specified(i32 0, i32 1)
12  ret void
13}
14
15declare void @underspecified(...)
16declare void @specified(i32, i32)
17
18; CHECK: callWithArgs:
19; CHECK: i32.const	$push1=, 0
20; CHECK-NEXT: i32.const	$push0=, 1
21; CHECK-NEXT: call    	.Lunderspecified_bitcast, $pop1, $pop0
22; CHECK: call    	.Lspecified_bitcast, $pop{{[0-9]+$}}
23
24; CHECK: .Lunderspecified_bitcast:
25; CHECK-NEXT: .functype .Lunderspecified_bitcast (i32, i32) -> (){{$}}
26; CHECK: call    	underspecified, $pop{{[0-9]+$}}
27
28; CHECK: .Lspecified_bitcast:
29; CHECK-NEXT: .functype .Lspecified_bitcast (i32) -> (){{$}}
30; CHECK: call    	specified, $pop{{[0-9]+}}, $pop{{[0-9]+$}}
31