Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 1 | // 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 | |
| 4 | struct X { |
| 5 | X(); |
| 6 | ~X(); |
| 7 | int data; |
| 8 | }; |
| 9 | |
| 10 | void vararg(...); |
| 11 | |
| 12 | void test(X x) { |
| 13 | // CHECK-LABEL: define void @"\01?test@@YAXUX@@@Z" |
| 14 | |
| 15 | // X86: %[[argmem:[^ ]*]] = alloca inalloca <{ %struct.X }> |
Pirama Arumuga Nainar | 33337ca | 2015-05-06 11:48:57 -0700 | [diff] [blame] | 16 | // X86: call void (<{ %struct.X }>*, ...) bitcast (void (...)* @"\01?vararg@@YAXZZ" to void (<{ %struct.X }>*, ...)*)(<{ %struct.X }>* inalloca %[[argmem]]) |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 17 | |
| 18 | // X64: alloca %struct.X |
| 19 | |
| 20 | // X64: %[[agg:[^ ]*]] = alloca %struct.X |
Pirama Arumuga Nainar | 3ea9e33 | 2015-04-08 08:57:32 -0700 | [diff] [blame] | 21 | // X64: %[[valptr:[^ ]*]] = getelementptr %struct.X, %struct.X* %[[agg]], i32 0, i32 0 |
| 22 | // X64: %[[val:[^ ]*]] = load i32, i32* %[[valptr]] |
Pirama Arumuga Nainar | 33337ca | 2015-05-06 11:48:57 -0700 | [diff] [blame] | 23 | // X64: call void (...) @"\01?vararg@@YAXZZ"(i32 %[[val]]) |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 24 | |
| 25 | // CHECK-NOT: llvm.trap |
| 26 | vararg(x); |
| 27 | // CHECK: ret void |
| 28 | } |