1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck %s 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuc // rdar://7309675 4*f4a2713aSLionel Sambuc // PR4678 5*f4a2713aSLionel Sambuc namespace test0 { 6*f4a2713aSLionel Sambuc // test1 should be compmiled to be a varargs function in the IR even 7*f4a2713aSLionel Sambuc // though there is no way to do a va_begin. Otherwise, the optimizer 8*f4a2713aSLionel Sambuc // will warn about 'dropped arguments' at the call site. 9*f4a2713aSLionel Sambuc 10*f4a2713aSLionel Sambuc // CHECK-LABEL: define i32 @_ZN5test05test1Ez(...) test1(...)11*f4a2713aSLionel Sambuc int test1(...) { 12*f4a2713aSLionel Sambuc return -1; 13*f4a2713aSLionel Sambuc } 14*f4a2713aSLionel Sambuc 15*f4a2713aSLionel Sambuc // CHECK: call i32 (...)* @_ZN5test05test1Ez(i32 0) test()16*f4a2713aSLionel Sambuc void test() { 17*f4a2713aSLionel Sambuc test1(0); 18*f4a2713aSLionel Sambuc } 19*f4a2713aSLionel Sambuc } 20*f4a2713aSLionel Sambuc 21*f4a2713aSLionel Sambuc namespace test1 { 22*f4a2713aSLionel Sambuc struct A { 23*f4a2713aSLionel Sambuc int x; 24*f4a2713aSLionel Sambuc int y; 25*f4a2713aSLionel Sambuc }; 26*f4a2713aSLionel Sambuc 27*f4a2713aSLionel Sambuc void foo(...); 28*f4a2713aSLionel Sambuc test()29*f4a2713aSLionel Sambuc void test() { 30*f4a2713aSLionel Sambuc A x; 31*f4a2713aSLionel Sambuc foo(x); 32*f4a2713aSLionel Sambuc } 33*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @_ZN5test14testEv() 34*f4a2713aSLionel Sambuc // CHECK: [[X:%.*]] = alloca [[A:%.*]], align 4 35*f4a2713aSLionel Sambuc // CHECK-NEXT: [[TMP:%.*]] = alloca [[A]], align 4 36*f4a2713aSLionel Sambuc // CHECK-NEXT: [[T0:%.*]] = bitcast [[A]]* [[TMP]] to i8* 37*f4a2713aSLionel Sambuc // CHECK-NEXT: [[T1:%.*]] = bitcast [[A]]* [[X]] to i8* 38*f4a2713aSLionel Sambuc // CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[T0]], i8* [[T1]], i64 8, i32 4, i1 false) 39*f4a2713aSLionel Sambuc // CHECK-NEXT: [[T0:%.*]] = bitcast [[A]]* [[TMP]] to i64* 40*f4a2713aSLionel Sambuc // CHECK-NEXT: [[T1:%.*]] = load i64* [[T0]], align 1 41*f4a2713aSLionel Sambuc // CHECK-NEXT: call void (...)* @_ZN5test13fooEz(i64 [[T1]]) 42*f4a2713aSLionel Sambuc // CHECK-NEXT: ret void 43*f4a2713aSLionel Sambuc } 44