// RUN: %clang_cc1 -no-opaque-pointers %s -triple=x86_64-apple-darwin10 -std=c++11 -emit-llvm -debug-info-kind=limited -o - | FileCheck %s
;
;
// CHECK-LABEL: define{{.*}} i32 @main
// CHECK: call void @_ZN1SC1ERKS_(%class.S* {{[^,]*}} [[AGGTMP:%[a-zA-Z0-9\.]+]], %class.S* noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) {{%[a-zA-Z0-9\.]+}})
// CHECK: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, %class.S*)*)(i8* noundef {{%[a-zA-Z0-9\.]+}}, i8* noundef {{%[a-zA-Z0-9\.]+}}, %class.S* noundef [[AGGTMP]])
// CHECK-NEXT: ret i32 0
int
// rdar://8379892
// CHECK-LABEL: define{{.*}} void @_Z1fP1A
// CHECK: call void @_ZN1XC1Ev(%struct.X* {{[^,]*}} [[LVTEMP:%[a-zA-Z0-9\.]+]])
// CHECK: call void @_ZN1XC1ERKS_(%struct.X* {{[^,]*}} [[AGGTMP:%[a-zA-Z0-9\.]+]], %struct.X* noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) [[LVTEMP]])
// CHECK: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, %struct.X*)*)({{.*}} %struct.X* noundef [[AGGTMP]])
;
void
// rdar://21801088
// Ensure that pseudo-objecet expressions that require the RHS to be
// rewritten don't result in crashes or redundant emission of code.
;
; B1 operator+;
;
;
int ;
// Note that there's a promotion from int to long long, so
// the syntactic form of the RHS will be bogus.
void
void
// CHECK: define{{.*}} void @_Z6testB0P1B([[B:%.*]]*
// CHECK: [[BVAR:%.*]] = alloca [[B]]*, align 8
// CHECK: [[TEMP:%.*]] = alloca [[B0:%.*]], align 8
// CHECK: [[X:%.*]] = getelementptr inbounds [[B0]], [[B0]]* [[TEMP]], i32 0, i32 0
// CHECK-NEXT: [[T0:%.*]] = call noundef i32 @_Z9b_makeIntv()
// CHECK-NEXT: [[T1:%.*]] = sext i32 [[T0]] to i64
// CHECK-NEXT: store i64 [[T1]], i64* [[X]], align 8
// CHECK: load [[B]]*, [[B]]** [[BVAR]]
// CHECK-NOT: call
// CHECK: call void @llvm.memcpy
// CHECK-NOT: call
// CHECK: call void bitcast {{.*}} @objc_msgSend
// CHECK-NOT: call
// CHECK: ret void
// CHECK: define{{.*}} void @_Z6testB1P1B([[B]]*
// CHECK: [[BVAR:%.*]] = alloca [[B]]*, align 8
// CHECK: load [[B]]*, [[B]]** [[BVAR]]
// CHECK-NOT: call
// CHECK: [[T0:%.*]] = call i64 bitcast {{.*}} @objc_msgSend
// CHECK-NOT: call
// CHECK: store i64 [[T0]],
// CHECK-NOT: call
// CHECK: [[T0:%.*]] = call noundef i32 @_Z9b_makeIntv()
// CHECK-NEXT: [[T1:%.*]] = sext i32 [[T0]] to i64
// CHECK-NEXT: store i64 [[T1]], i64* {{.*}}, align 8
// CHECK-NOT: call
// CHECK: [[T0:%.*]] = call i64 @_Zpl2B1S_
// CHECK-NOT: call
// CHECK: store i64 [[T0]],
// CHECK-NOT: call
// CHECK: call void @llvm.memcpy
// CHECK-NOT: call
// CHECK: call void bitcast {{.*}} @objc_msgSend
// CHECK-NOT: call
// CHECK: ret void
// Another example of a conversion that needs to be applied
// in the semantic form.
void
// CHECK: define{{.*}} void @_Z6testB2P1B([[B]]*
// CHECK: [[BVAR:%.*]] = alloca [[B]]*, align 8
// CHECK: call void @llvm.dbg.declare(
// CHECK: call void @_ZN2B3C1Ev(
// CHECK-NEXT: [[T0:%.*]] = call i64 @_ZN2B3cv2B1Ev(
// CHECK-NOT: call
// CHECK: store i64 [[T0]],
// CHECK: load [[B]]*, [[B]]** [[BVAR]]
// CHECK-NOT: call
// CHECK: call void @llvm.memcpy
// CHECK-NOT: call
// CHECK: call void bitcast {{.*}} @objc_msgSend
// CHECK-NOT: call
// CHECK: ret void
// A similar test to B, but using overloaded function references.
;
void ;
void ;
void
// CHECK: define{{.*}} void @_Z6testC0P1C([[C:%.*]]*
// CHECK: [[CVAR:%.*]] = alloca [[C]]*, align 8
// CHECK: load [[C]]*, [[C]]** [[CVAR]]
// CHECK-NOT: call
// CHECK: call void bitcast {{.*}} @objc_msgSend {{.*}} @_Z8c_helperv
// CHECK-NOT: call
// CHECK: call void bitcast {{.*}} @objc_msgSend {{.*}} @_Z8c_helperv
// CHECK-NOT: call
// CHECK: ret void
void
// CHECK: define{{.*}} void @_Z6testC1P1C([[C]]*
// CHECK: [[CVAR:%.*]] = alloca [[C]]*, align 8
// CHECK: load [[C]]*, [[C]]** [[CVAR]]
// CHECK-NOT: call
// CHECK: [[T0:%.*]] = call i32 bitcast {{.*}} @objc_msgSend
// CHECK-NOT: call
// CHECK: store i32 [[T0]],
// CHECK-NOT: call
// CHECK: [[T0:%.*]] = call i32 @_Zpl2C1RFvvE({{.*}} @_Z8c_helperv
// CHECK-NOT: call
// CHECK: store i32 [[T0]],
// CHECK-NOT: call
// CHECK: call void @llvm.memcpy
// CHECK-NOT: call
// CHECK: call void bitcast {{.*}} @objc_msgSend
// CHECK-NOT: call
// CHECK: ret void