1; RUN: llvm-dis < %s.bc| FileCheck %s
2; RUN: verify-uselistorder < %s.bc
3
4; vaArgIntrinsic.3.2.ll.bc was generated by passing this file to llvm-as-3.2.
5; The test checks that LLVM does not misread variable argument intrinsic instructions
6; of older bitcode files.
7
8define i32 @varArgIntrinsic(i32 %X, ...) {
9
10  %ap = alloca i8*
11  %ap2 = bitcast i8** %ap to i8*
12
13; CHECK: call void @llvm.va_start(i8* %ap2)
14  call void @llvm.va_start(i8* %ap2)
15
16; CHECK-NEXT: %tmp = va_arg i8** %ap, i32
17  %tmp = va_arg i8** %ap, i32
18
19  %aq = alloca i8*
20  %aq2 = bitcast i8** %aq to i8*
21
22; CHECK: call void @llvm.va_copy(i8* %aq2, i8* %ap2)
23  call void @llvm.va_copy(i8* %aq2, i8* %ap2)
24; CHECK-NEXT: call void @llvm.va_end(i8* %aq2)
25  call void @llvm.va_end(i8* %aq2)
26
27; CHECK-NEXT:  call void @llvm.va_end(i8* %ap2)
28  call void @llvm.va_end(i8* %ap2)
29  ret i32 %tmp
30}
31
32declare void @llvm.va_start(i8*)
33declare void @llvm.va_copy(i8*, i8*)
34declare void @llvm.va_end(i8*)
35