blob: da05c0b5248edf76e1d1b15174d7e1ccd5e74b47 [file] [log] [blame]
Hans Wennborgd9dd4d22014-09-29 23:06:57 +00001// RUN: %clang_cc1 -Wno-error=non-pod-varargs -triple i686-pc-win32 -fms-compatibility -emit-llvm -o - %s | FileCheck %s -check-prefix=X86 -check-prefix=CHECK
2// RUN: %clang_cc1 -Wno-error=non-pod-varargs -triple x86_64-pc-win32 -fms-compatibility -emit-llvm -o - %s | FileCheck %s -check-prefix=X64 -check-prefix=CHECK
3
4struct X {
5 X();
6 ~X();
7 int data;
8};
9
10void vararg(...);
11
12void test(X x) {
13 // CHECK-LABEL: define void @"\01?test@@YAXUX@@@Z"
14
15 // X86: %[[argmem:[^ ]*]] = alloca inalloca <{ %struct.X }>
16 // X86: call void (<{ %struct.X }>*, ...)* bitcast (void (...)* @"\01?vararg@@YAXZZ" to void (<{ %struct.X }>*, ...)*)(<{ %struct.X }>* inalloca %[[argmem]])
17
18 // X64: %[[valptr:[^ ]*]] = getelementptr %struct.X* %{{[^ ]*}}, i32 0, i32 0
19 // X64: %[[val:[^ ]*]] = load i32* %[[valptr]]
20 // X64: call void (...)* @"\01?vararg@@YAXZZ"(i32 %[[val]])
21
22 // CHECK-NOT: llvm.trap
23 vararg(x);
24 // CHECK: ret void
25}
26