xref: /llvm-project/llvm/test/Transforms/DeadArgElim/2008-01-16-VarargsParamAttrs.ll (revision 055fb7795aa219a3d274d280ec9129784f169f56)
1; RUN: opt < %s -passes=deadargelim -S | grep byval
2
3	%struct.point = type { double, double }
4@pts = global [4 x %struct.point] [ %struct.point { double 1.000000e+00, double 2.000000e+00 }, %struct.point { double 3.000000e+00, double 4.000000e+00 }, %struct.point { double 5.000000e+00, double 6.000000e+00 }, %struct.point { double 7.000000e+00, double 8.000000e+00 } ], align 32		; <ptr> [#uses=1]
5
6define internal i32 @va1(i32 %nargs, ...) {
7entry:
8	%pi = alloca %struct.point		; <ptr> [#uses=0]
9	%args = alloca ptr		; <ptr> [#uses=2]
10	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
11	call void @llvm.va_start( ptr %args )
12	call void @llvm.va_end( ptr %args )
13	ret i32 undef
14}
15
16declare void @llvm.va_start(ptr) nounwind
17
18declare void @llvm.va_end(ptr) nounwind
19
20define i32 @main() {
21entry:
22	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
23	%tmp = getelementptr [4 x %struct.point], ptr @pts, i32 0, i32 0		; <ptr> [#uses=1]
24	%tmp1 = call i32 (i32, ...) @va1(i32 1, ptr byval(%struct.point) %tmp) nounwind 		; <i32> [#uses=0]
25	call void @exit( i32 0 ) noreturn nounwind
26	unreachable
27}
28
29declare void @exit(i32) noreturn nounwind
30