2013-09-04 12:12:25 +08:00
|
|
|
// RUN: %clang_cc1 -triple=x86_64-apple-darwin -emit-llvm -o - %s | FileCheck %s
|
2013-01-26 07:57:05 +08:00
|
|
|
// rdar://11861085
|
|
|
|
|
|
|
|
struct s {
|
|
|
|
char filler [128];
|
|
|
|
volatile int x;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct s gs;
|
|
|
|
|
|
|
|
void foo (void) {
|
|
|
|
struct s ls;
|
|
|
|
ls = ls;
|
|
|
|
gs = gs;
|
|
|
|
ls = gs;
|
|
|
|
}
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @_Z3foov()
|
2013-01-26 09:25:32 +08:00
|
|
|
// CHECK: %[[LS:.*]] = alloca %struct.s, align 4
|
|
|
|
// CHECK-NEXT: %[[ZERO:.*]] = bitcast %struct.s* %[[LS]] to i8*
|
|
|
|
// CHECK-NEXT: %[[ONE:.*]] = bitcast %struct.s* %[[LS]] to i8*
|
2015-11-19 13:55:59 +08:00
|
|
|
// CHECK-NEXT: call void @llvm.memcpy.{{.*}}(i8* %[[ZERO]], i8* %[[ONE]], i64 132, i32 4, i1 true)
|
|
|
|
// CHECK-NEXT: call void @llvm.memcpy.{{.*}}(i8* getelementptr inbounds (%struct.s, %struct.s* @gs, i32 0, i32 0, i32 0), i8* getelementptr inbounds (%struct.s, %struct.s* @gs, i32 0, i32 0, i32 0), i64 132, i32 4, i1 true)
|
2013-01-26 09:25:32 +08:00
|
|
|
// CHECK-NEXT: %[[TWO:.*]] = bitcast %struct.s* %[[LS]] to i8*
|
2015-11-19 13:55:59 +08:00
|
|
|
// CHECK-NEXT: call void @llvm.memcpy.{{.*}}(i8* %[[TWO]], i8* getelementptr inbounds (%struct.s, %struct.s* @gs, i32 0, i32 0, i32 0), i64 132, i32 4, i1 true)
|
2013-01-26 09:25:32 +08:00
|
|
|
|
2013-01-26 07:57:05 +08:00
|
|
|
|
|
|
|
struct s1 {
|
|
|
|
struct s y;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct s1 s;
|
|
|
|
|
|
|
|
void fee (void) {
|
|
|
|
s = s;
|
|
|
|
s.y = gs;
|
|
|
|
}
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @_Z3feev()
|
2015-11-19 13:55:59 +08:00
|
|
|
// CHECK: call void @llvm.memcpy.{{.*}}(i8* getelementptr inbounds (%struct.s1, %struct.s1* @s, i32 0, i32 0, i32 0, i32 0), i8* getelementptr inbounds (%struct.s1, %struct.s1* @s, i32 0, i32 0, i32 0, i32 0), i64 132, i32 4, i1 true)
|
|
|
|
// CHECK-NEXT: call void @llvm.memcpy.{{.*}}(i8* getelementptr inbounds (%struct.s1, %struct.s1* @s, i32 0, i32 0, i32 0, i32 0), i8* getelementptr inbounds (%struct.s, %struct.s* @gs, i32 0, i32 0, i32 0), i64 132, i32 4, i1 true)
|
2013-01-26 07:57:05 +08:00
|
|
|
|
|
|
|
struct d : s1 {
|
|
|
|
};
|
|
|
|
|
|
|
|
d gd;
|
|
|
|
|
|
|
|
void gorf(void) {
|
|
|
|
gd = gd;
|
|
|
|
}
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @_Z4gorfv()
|
2015-11-19 13:55:59 +08:00
|
|
|
// CHECK: call void @llvm.memcpy.{{.*}}(i8* getelementptr inbounds (%struct.d, %struct.d* @gd, i32 0, i32 0, i32 0, i32 0, i32 0), i8* getelementptr inbounds (%struct.d, %struct.d* @gd, i32 0, i32 0, i32 0, i32 0, i32 0), i64 132, i32 4, i1 true)
|