Dan Gohman | 3a762bf | 2017-12-08 21:27:00 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -asm-verbose=false -wasm-temporary-workarounds=false | FileCheck %s |
| 2 | |
| 3 | ; Test that function pointer casts casting away varargs are replaced with |
| 4 | ; wrappers. |
| 5 | |
| 6 | target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" |
| 7 | target triple = "wasm32-unknown-unknown-wasm" |
| 8 | |
| 9 | define void @callWithArgs() { |
| 10 | entry: |
| 11 | call void bitcast (void (...)* @underspecified to void (i32, i32)*)(i32 0, i32 1) |
| 12 | call void(...) bitcast (void (i32, i32)* @specified to void (...)*)(i32 0, i32 1) |
| 13 | ret void |
| 14 | } |
| 15 | |
| 16 | declare void @underspecified(...) |
| 17 | declare void @specified(i32, i32) |
| 18 | |
| 19 | ; CHECK: callWithArgs: |
| 20 | ; CHECK: i32.const $push1=, 0 |
| 21 | ; CHECK-NEXT: i32.const $push0=, 1 |
| 22 | ; CHECK-NEXT: call .Lbitcast@FUNCTION, $pop1, $pop0 |
| 23 | ; CHECK: call .Lbitcast.1@FUNCTION, $pop{{[0-9]+$}} |
| 24 | |
| 25 | ; CHECK: .Lbitcast: |
| 26 | ; CHECK-NEXT: .param i32, i32{{$}} |
| 27 | ; CHECK: call underspecified@FUNCTION, $pop{{[0-9]+$}} |
| 28 | |
| 29 | ; CHECK: .Lbitcast.1: |
| 30 | ; CHECK-NEXT: .param i32{{$}} |
| 31 | ; CHECK: call specified@FUNCTION, $pop{{[0-9]+}}, $pop{{[0-9]+$}} |