1; RUN: opt -S -instcombine %s | FileCheck %s
2
3declare void @add_byval_callee(double*)
4
5; CHECK-LABEL: define void @add_byval
6; CHECK: [[ARG:%.*]] = bitcast i64* %in to double*
7; CHECK: call void @add_byval_callee(double* byval(double) [[ARG]])
8define void @add_byval(i64* %in) {
9  %tmp = bitcast void (double*)* @add_byval_callee to void (i64*)*
10  call void %tmp(i64* byval(i64) %in)
11  ret void
12}
13
14%t2 = type { i8 }
15
16; CHECK-LABEL: define void @vararg_byval
17; CHECK: call void (i8, ...) @vararg_callee(i8 undef, i8* byval(i8) %p)
18define void @vararg_byval(i8* %p) {
19  %tmp = bitcast i8* %p to %t2*
20  call void (i8, ...) @vararg_callee(i8 undef, %t2* byval(%t2) %tmp)
21  ret void
22}
23
24declare void @vararg_callee(i8, ...)
25